PHP Class GuzzleHttp\Exception\RequestException

Inheritance: extends TransferException
Afficher le fichier Open project: guzzle/guzzle Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( $message, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response = null, Exception $previous = null, array $handlerContext = [] )
create ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response = null, Exception $previous = null, array $ctx = [] ) : self Factory method to create a new exception with a normalized error message
getHandlerContext ( ) : array Get contextual information about the error from the underlying handler.
getRequest ( ) : Psr\Http\Message\RequestInterface Get the request that caused the exception
getResponse ( ) : Psr\Http\Message\ResponseInterface | null Get the associated response
getResponseBodySummary ( Psr\Http\Message\ResponseInterface $response ) : string | null Get a short summary of the response
hasResponse ( ) : boolean Check if a response was received
wrapException ( Psr\Http\Message\RequestInterface $request, Exception $e ) : RequestException Wrap non-RequestExceptions with a RequestException

Private Methods

Méthode Description
obfuscateUri ( Psr\Http\Message\UriInterface $uri ) : Psr\Http\Message\UriInterface Obfuscates URI if there is an username and a password present

Method Details

__construct() public méthode

public __construct ( $message, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response = null, Exception $previous = null, array $handlerContext = [] )
$request Psr\Http\Message\RequestInterface
$response Psr\Http\Message\ResponseInterface
$previous Exception
$handlerContext array

create() public static méthode

Factory method to create a new exception with a normalized error message
public static create ( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response = null, Exception $previous = null, array $ctx = [] ) : self
$request Psr\Http\Message\RequestInterface Request
$response Psr\Http\Message\ResponseInterface Response received
$previous Exception Previous exception
$ctx array Optional handler context.
Résultat self

getHandlerContext() public méthode

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.
public getHandlerContext ( ) : array
Résultat array

getRequest() public méthode

Get the request that caused the exception
public getRequest ( ) : Psr\Http\Message\RequestInterface
Résultat Psr\Http\Message\RequestInterface

getResponse() public méthode

Get the associated response
public getResponse ( ) : Psr\Http\Message\ResponseInterface | null
Résultat Psr\Http\Message\ResponseInterface | null

getResponseBodySummary() public static méthode

Will return null if the response is not printable.
public static getResponseBodySummary ( Psr\Http\Message\ResponseInterface $response ) : string | null
$response Psr\Http\Message\ResponseInterface
Résultat string | null

hasResponse() public méthode

Check if a response was received
public hasResponse ( ) : boolean
Résultat boolean

wrapException() public static méthode

Wrap non-RequestExceptions with a RequestException
public static wrapException ( Psr\Http\Message\RequestInterface $request, Exception $e ) : RequestException
$request Psr\Http\Message\RequestInterface
$e Exception
Résultat RequestException