Google API Core Client - Class ApiException (1.35.0)

Reference documentation and code samples for the Google API Core Client class ApiException.

Represents an exception thrown during an RPC.

Namespace

Google \ ApiCore

Methods

__construct

ApiException constructor.

Parameters
Name Description
message string
code int
status string|null
optionalArgs array

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

↳ previous Exception|null
↳ metadata array|null
↳ basicMessage string|null

getStatus

getReason

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

Returns
Type Description
string|null $reason

getDomain

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

Returns
Type Description
string|null $domain

getErrorInfoMetadata

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

Returns
Type Description
array|null $errorInfoMetadata

getBasicMessage

Returns
Type Description
null|string

getMetadata

Returns
Type Description
array

__toString

String representation of ApiException

Returns
Type Description
string

static::createFromStdClass

Parameter
Name Description
status stdClass
Returns
Type Description
ApiException

static::createFromApiResponse

Parameters
Name Description
basicMessage string
rpcCode int
metadata array|null
previous Exception
Returns
Type Description
ApiException

static::createFromRestApiResponse

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

Parameters
Name Description
basicMessage string
rpcCode int
metadata array|null
previous Exception
Returns
Type Description
ApiException

static::createFromRpcStatus

Parameter
Name Description
status Google\Rpc\Status
Returns
Type Description
ApiException

static::createFromRequestException

Creates an ApiException from a GuzzleHttp RequestException.

Parameters
Name Description
ex GuzzleHttp\Exception\RequestException
isStream bool
Returns
Type Description
ApiException