class ApiException extends Exception (View source)

Represents an exception thrown during an RPC.

Methods

__construct(string $message, int $code, string $status = null, array $optionalArgs = [])

ApiException constructor.

getStatus()

No description

string|null
getReason()

Returns the reason in ErrorInfo for an exception, or null if there is no ErrorInfo.

string|null
getDomain()

Returns the domain in ErrorInfo for an exception, or null if there is no ErrorInfo.

array|null
getErrorInfoMetadata()

Returns the metadata in ErrorInfo for an exception, or null if there is no ErrorInfo.

static ApiException
createFromStdClass(stdClass $status)

No description

static ApiException
createFromApiResponse(string $basicMessage, int $rpcCode, array $metadata = null, Exception $previous = null)

No description

static ApiException
createFromRestApiResponse(string $basicMessage, int $rpcCode, array $metadata = null, Exception $previous = null)

For REST-based responses, the metadata does not need to be decoded.

static ApiException
createFromRpcStatus(Status $status)

No description

static ApiException
createFromRequestException(RequestException $ex, bool $isStream = false)

Creates an ApiException from a GuzzleHttp RequestException.

null|string
getBasicMessage()

No description

array
getMetadata()

No description

string
__toString()

String representation of ApiException

Details

__construct(string $message, int $code, string $status = null, array $optionalArgs = [])

ApiException constructor.

Parameters

string $message
int $code
string $status
array $optionalArgs

{ @type Exception|null $previous @type array|null $metadata @type string|null $basicMessage }

getStatus()

No description

string|null getReason()

Returns the reason in ErrorInfo for an exception, or null if there is no ErrorInfo.

Return Value

string|null $reason

string|null getDomain()

Returns the domain in ErrorInfo for an exception, or null if there is no ErrorInfo.

Return Value

string|null $domain

array|null getErrorInfoMetadata()

Returns the metadata in ErrorInfo for an exception, or null if there is no ErrorInfo.

Return Value

array|null $errorInfoMetadata

static ApiException createFromStdClass(stdClass $status)

No description

Parameters

stdClass $status

Return Value

ApiException

static ApiException createFromApiResponse(string $basicMessage, int $rpcCode, array $metadata = null, Exception $previous = null)

No description

Parameters

string $basicMessage
int $rpcCode
array $metadata
Exception $previous

Return Value

ApiException

static ApiException createFromRestApiResponse(string $basicMessage, int $rpcCode, array $metadata = null, Exception $previous = null)

For REST-based responses, the metadata does not need to be decoded.

Parameters

string $basicMessage
int $rpcCode
array $metadata
Exception $previous

Return Value

ApiException

static ApiException createFromRpcStatus(Status $status)

No description

Parameters

Status $status

Return Value

ApiException

static ApiException createFromRequestException(RequestException $ex, bool $isStream = false)

Creates an ApiException from a GuzzleHttp RequestException.

Parameters

RequestException $ex
bool $isStream

Return Value

ApiException

Exceptions

ValidationException

null|string getBasicMessage()

No description

Return Value

null|string

array getMetadata()

No description

Return Value

array

string __toString()

String representation of ApiException

Return Value

string