\GuzzleHttp\ExceptionServerException

Exception when a server error is encountered (5xx codes)

Summary

Methods
Properties
Constants
__construct()
hasResponse()
getResponse()
wrapException()
create()
getRequest()
getHandlerContext()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
obfuscateUri()
$request
$response
$handlerContext
N/A

Properties

$request

$request : \Psr\Http\Message\RequestInterface

Type

RequestInterface

$handlerContext

$handlerContext : array

Type

array

Methods

__construct()

__construct(string  $message, \Psr\Http\Message\RequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response = null, \Throwable  $previous = null, array  $handlerContext = []) : mixed

Parameters

string $message
\Psr\Http\Message\RequestInterface $request
\Psr\Http\Message\ResponseInterface $response
\Throwable $previous
array $handlerContext

Returns

mixed —

hasResponse()

hasResponse() : bool

Check if a response was received

Returns

bool —

getResponse()

getResponse() : ?\Psr\Http\Message\ResponseInterface

Get the associated response

Returns

?\Psr\Http\Message\ResponseInterface —

wrapException()

wrapException(\Psr\Http\Message\RequestInterface  $request, \Throwable  $e) : \GuzzleHttp\Exception\RequestException

Wrap non-RequestExceptions with a RequestException

Parameters

\Psr\Http\Message\RequestInterface $request
\Throwable $e

Returns

\GuzzleHttp\Exception\RequestException —

create()

create(\Psr\Http\Message\RequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response = null, \Throwable|null  $previous = null, array  $handlerContext = [], \GuzzleHttp\BodySummarizerInterface|null  $bodySummarizer = null) : self

Factory method to create a new exception with a normalized error message

Parameters

\Psr\Http\Message\RequestInterface $request

Request sent

\Psr\Http\Message\ResponseInterface $response

Response received

\Throwable|null $previous

Previous exception

array $handlerContext

Optional handler context

\GuzzleHttp\BodySummarizerInterface|null $bodySummarizer

Optional body summarizer

Returns

self —

getRequest()

getRequest() : \Psr\Http\Message\RequestInterface

Get the request that caused the exception

Returns

\Psr\Http\Message\RequestInterface —

getHandlerContext()

getHandlerContext() : array

Get contextual information about the error from the underlying handler.

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.

Returns

array —

obfuscateUri()

obfuscateUri(\Psr\Http\Message\UriInterface  $uri) : \Psr\Http\Message\UriInterface

Obfuscates URI if there is a username and a password present

Parameters

\Psr\Http\Message\UriInterface $uri

Returns

\Psr\Http\Message\UriInterface —