Documentation

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

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

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

Search results