Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
GuzzleHttp\Exception\BadResponseException Class Reference
Inheritance diagram for GuzzleHttp\Exception\BadResponseException:
GuzzleHttp\Exception\RequestException GuzzleHttp\Exception\TransferException Psr\Http\Client\RequestExceptionInterface GuzzleHttp\Exception\GuzzleException Psr\Http\Client\ClientExceptionInterface Psr\Http\Client\ClientExceptionInterface GuzzleHttp\Exception\ClientException GuzzleHttp\Exception\ServerException

Public Member Functions

 __construct (string $message, RequestInterface $request, ResponseInterface $response, Throwable $previous=null, array $handlerContext=[])
 
 getHandlerContext ()
 Get contextual information about the error from the underlying handler.
 
 getRequest ()
 Get the request that caused the exception.
 
 getResponse ()
 This function narrows the return type from the parent class and does not allow it to be nullable.
 
 hasResponse ()
 Current exception and the ones that extend it will always have a response.
 

Static Public Member Functions

static create (RequestInterface $request, ResponseInterface $response=null, Throwable $previous=null, array $handlerContext=[], BodySummarizerInterface $bodySummarizer=null)
 Factory method to create a new exception with a normalized error message.
 
static wrapException (RequestInterface $request, Throwable $e)
 Wrap non-RequestExceptions with a RequestException.
 

Constructor & Destructor Documentation

◆ __construct()

GuzzleHttp\Exception\BadResponseException::__construct ( string $message,
RequestInterface $request,
ResponseInterface $response,
Throwable $previous = null,
array $handlerContext = [] )

Member Function Documentation

◆ create()

static GuzzleHttp\Exception\RequestException::create ( RequestInterface $request,
ResponseInterface $response = null,
Throwable $previous = null,
array $handlerContext = [],
BodySummarizerInterface $bodySummarizer = null )
staticinherited

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

Parameters
RequestInterface$requestRequest sent
ResponseInterface$responseResponse received
Throwable | null$previousPrevious exception
array$handlerContextOptional handler context
BodySummarizerInterface | null$bodySummarizerOptional body summarizer

◆ getHandlerContext()

GuzzleHttp\Exception\RequestException::getHandlerContext ( )
inherited

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.

◆ getRequest()

GuzzleHttp\Exception\RequestException::getRequest ( )
inherited

Get the request that caused the exception.

Implements Psr\Http\Client\RequestExceptionInterface.

◆ getResponse()

GuzzleHttp\Exception\BadResponseException::getResponse ( )

This function narrows the return type from the parent class and does not allow it to be nullable.

Reimplemented from GuzzleHttp\Exception\RequestException.

◆ hasResponse()

GuzzleHttp\Exception\BadResponseException::hasResponse ( )

Current exception and the ones that extend it will always have a response.

Reimplemented from GuzzleHttp\Exception\RequestException.


The documentation for this class was generated from the following file: