WrappedHttpHandler
in package
Converts an HTTP handler into a Command HTTP handler.
HTTP handlers have the following signature: function(RequestInterface $request, array $options) : PromiseInterface
The promise returned form an HTTP handler must resolve to a PSR-7 response object when fulfilled or an error array when rejected. The error array can contain the following data:
- exception: (required, Exception) Exception that was encountered.
- response: (ResponseInterface) PSR-7 response that was received (if a response) was received.
- connection_error: (bool) True if the error is the result of failing to connect.
Table of Contents
- $collectStats : mixed
- $errorParser : mixed
- $exceptionClass : mixed
- $httpHandler : mixed
- $parser : mixed
- __construct() : mixed
- __invoke() : PromiseInterface
- Calls the simpler HTTP specific handler and wraps the returned promise with AWS specific values (e.g., a result object or AWS exception).
- parseError() : Exception
- Parses a rejection into an AWS error.
- parseResponse() : ResultInterface
Properties
$collectStats
private
mixed
$collectStats
$errorParser
private
mixed
$errorParser
$exceptionClass
private
mixed
$exceptionClass
$httpHandler
private
mixed
$httpHandler
$parser
private
mixed
$parser
Methods
__construct()
public
__construct(callable $httpHandler, callable $parser, callable $errorParser[, string $exceptionClass = 'Aws\Exception\AwsException' ][, bool $collectStats = false ]) : mixed
Parameters
- $httpHandler : callable
-
Function that accepts a request and array of request options and returns a promise that fulfills with a response or rejects with an error array.
- $parser : callable
-
Function that accepts a response object and returns an AWS result object.
- $errorParser : callable
-
Function that parses a response object into AWS error data.
- $exceptionClass : string = 'Aws\Exception\AwsException'
-
Exception class to throw.
- $collectStats : bool = false
-
Whether to collect HTTP transfer information.
Return values
mixed —__invoke()
Calls the simpler HTTP specific handler and wraps the returned promise with AWS specific values (e.g., a result object or AWS exception).
public
__invoke(CommandInterface $command, RequestInterface $request) : PromiseInterface
Parameters
- $command : CommandInterface
-
Command being executed.
- $request : RequestInterface
-
Request to send.
Return values
PromiseInterface —parseError()
Parses a rejection into an AWS error.
private
parseError(array<string|int, mixed> $err, RequestInterface $request, CommandInterface $command, array<string|int, mixed> $stats) : Exception
Parameters
- $err : array<string|int, mixed>
-
Rejection error array.
- $request : RequestInterface
-
Request that was sent.
- $command : CommandInterface
-
Command being sent.
- $stats : array<string|int, mixed>
-
Transfer statistics
Return values
Exception —parseResponse()
private
parseResponse(CommandInterface $command, RequestInterface $request, ResponseInterface $response, array<string|int, mixed> $stats) : ResultInterface
Parameters
- $command : CommandInterface
- $request : RequestInterface
- $response : ResponseInterface
- $stats : array<string|int, mixed>