BadResponseException
extends RequestException
in package
Exception when an HTTP error occurs (4xx or 5xx error)
Table of Contents
Properties
- $handlerContext : array<string|int, mixed>
- $request : RequestInterface
- $response : ResponseInterface|null
Methods
- __construct() : mixed
- create() : self
- Factory method to create a new exception with a normalized error message
- getHandlerContext() : array<string|int, mixed>
- Get contextual information about the error from the underlying handler.
- getRequest() : RequestInterface
- Get the request that caused the exception
- getResponse() : ResponseInterface
- This function narrows the return type from the parent class and does not allow it to be nullable.
- hasResponse() : bool
- Current exception and the ones that extend it will always have a response.
- wrapException() : RequestException
- Wrap non-RequestExceptions with a RequestException
Properties
$handlerContext
private
array<string|int, mixed>
$handlerContext
$request
private
RequestInterface
$request
$response
private
ResponseInterface|null
$response
Methods
__construct()
public
__construct(string $message, RequestInterface $request, ResponseInterface $response[, Throwable|null $previous = null ][, array<string|int, mixed> $handlerContext = [] ]) : mixed
Parameters
- $message : string
- $request : RequestInterface
- $response : ResponseInterface
- $previous : Throwable|null = null
- $handlerContext : array<string|int, mixed> = []
create()
Factory method to create a new exception with a normalized error message
public
static create(RequestInterface $request[, ResponseInterface $response = null ][, Throwable|null $previous = null ][, array<string|int, mixed> $handlerContext = [] ][, BodySummarizerInterface|null $bodySummarizer = null ]) : self
Parameters
- $request : RequestInterface
-
Request sent
- $response : ResponseInterface = null
-
Response received
- $previous : Throwable|null = null
-
Previous exception
- $handlerContext : array<string|int, mixed> = []
-
Optional handler context
- $bodySummarizer : BodySummarizerInterface|null = null
-
Optional body summarizer
Return values
selfgetHandlerContext()
Get contextual information about the error from the underlying handler.
public
getHandlerContext() : array<string|int, mixed>
The contents of this array will vary depending on which handler you are using. It may also be just an empty array. Relying on this data will couple you to a specific handler, but can give more debug information when needed.
Return values
array<string|int, mixed>getRequest()
Get the request that caused the exception
public
getRequest() : RequestInterface
Return values
RequestInterfacegetResponse()
This function narrows the return type from the parent class and does not allow it to be nullable.
public
getResponse() : ResponseInterface
Return values
ResponseInterfacehasResponse()
Current exception and the ones that extend it will always have a response.
public
hasResponse() : bool
Return values
boolwrapException()
Wrap non-RequestExceptions with a RequestException
public
static wrapException(RequestInterface $request, Throwable $e) : RequestException
Parameters
- $request : RequestInterface
- $e : Throwable