     1: <?php
     2:
     3: namespace OpenCloud\Common\Exceptions;
     4:
     5: use Guzzle\Http\Exception\BadResponseException;
     6:
     7: class ResourceNotFoundException extends HttpResponseException
     8: {
     9:     public static function factory(BadResponseException $exception)
    10:     {
    11:         $response = $exception->getResponse();
    12:
    13:         $message = sprintf(
    14:             "This resource you were looking for could not be found; the API returned a %s status code with this message:\n%s",
    15:             $response->getStatusCode(),
    16:             (string) $response->getBody()
    17:         );
    18:
    19:         $e = new self($message);
    20:         $e->setResponse($response);
    21:         $e->setRequest($exception->getRequest());
    22:
    23:         return $e;
    24:     }
    25: }
    26: