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