2 namespace GuzzleHttp\Exception;
4 use Psr\Http\Message\RequestInterface;
5 use Psr\Http\Message\ResponseInterface;
8 * Exception when an HTTP error occurs (4xx or 5xx error)
10 class BadResponseException extends RequestException
12 public function __construct(
14 RequestInterface $request,
15 ResponseInterface $response = null,
16 \Exception $previous = null,
17 array $handlerContext = []
19 if (null === $response) {
21 'Instantiating the ' . __CLASS__ . ' class without a Response is deprecated since version 6.3 and will be removed in 7.0.',
25 parent::__construct($message, $request, $response, $previous, $handlerContext);