Files
cunkebao_v3/Server/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php

40 lines
982 B
PHP
Raw Normal View History

2025-03-12 12:21:57 +08:00
<?php
2025-03-24 14:59:19 +08:00
2025-03-12 12:21:57 +08:00
namespace GuzzleHttp\Exception;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
* Exception when an HTTP error occurs (4xx or 5xx error)
*/
class BadResponseException extends RequestException
{
public function __construct(
2025-03-24 14:59:19 +08:00
string $message,
2025-03-12 12:21:57 +08:00
RequestInterface $request,
2025-03-24 14:59:19 +08:00
ResponseInterface $response,
?\Throwable $previous = null,
2025-03-12 12:21:57 +08:00
array $handlerContext = []
) {
parent::__construct($message, $request, $response, $previous, $handlerContext);
}
2025-03-24 14:59:19 +08:00
/**
* Current exception and the ones that extend it will always have a response.
*/
public function hasResponse(): bool
{
return true;
}
/**
* This function narrows the return type from the parent class and does not allow it to be nullable.
*/
public function getResponse(): ResponseInterface
{
/** @var ResponseInterface */
return parent::getResponse();
}
2025-03-12 12:21:57 +08:00
}