class ClientException extends RequestException

Traits

Constants

DEFAULT_TRUNCATE_AT

The default truncation length for exception messages.

Properties

false|int|null $truncateExceptionsAt

The current truncation length for the exception message.

from  RequestException
static false|int $truncateAt

The global truncation length for the exception message.

from  RequestException
bool $hasBeenSummarized

Whether the response has been summarized in the message.

from  RequestException

Methods

__construct(Response $response, false|int|null $truncateExceptionsAt = null)

Create a new exception instance.

static void
truncate()

Enable truncation of request exception messages.

static void
truncateAt(int $length)

Set the truncation length for request exception messages.

static void
dontTruncate()

Disable truncation of request exception messages.

bool
report()

Prepare the exception message and set the summarized flag.

string
prepareMessage(Response $response)

Prepare the exception message.

static void
flushState()

Flush all static state.

bool
ok()

Determine if the response code was 200 "OK" response.

bool
created()

Determine if the response code was 201 "Created" response.

bool
accepted()

Determine if the response code was 202 "Accepted" response.

bool
noContent(int $status = 204)

Determine if the response code was the given status code and the body has no content.

bool
movedPermanently()

Determine if the response code was a 301 "Moved Permanently".

bool
found()

Determine if the response code was a 302 "Found" response.

bool
notModified()

Determine if the response code was a 304 "Not Modified" response.

bool
badRequest()

Determine if the response was a 400 "Bad Request" response.

bool
unauthorized()

Determine if the response was a 401 "Unauthorized" response.

bool
paymentRequired()

Determine if the response was a 402 "Payment Required" response.

bool
forbidden()

Determine if the response was a 403 "Forbidden" response.

bool
notFound()

Determine if the response was a 404 "Not Found" response.

bool
requestTimeout()

Determine if the response was a 408 "Request Timeout" response.

bool
conflict()

Determine if the response was a 409 "Conflict" response.

bool
unprocessableContent()

Determine if the response was a 422 "Unprocessable Content" response.

bool
unprocessableEntity()

Determine if the response was a 422 "Unprocessable Content" response.

bool
tooManyRequests()

Determine if the response was a 429 "Too Many Requests" response.

response()

Get the Saloon response.

pendingRequest()

Get the pending request.

int
status()

Get the HTTP status code.

string
body()

Get the response body.

Details

in RequestException at line 34
__construct(Response $response, false|int|null $truncateExceptionsAt = null)

Create a new exception instance.

Parameters

Response $response
false|int|null $truncateExceptionsAt

in RequestException at line 49
static void truncate()

Enable truncation of request exception messages.

Boot-only. The global default persists for the worker lifetime across all coroutines; per-request truncation settings take precedence.

Return Value

void

in RequestException at line 60
static void truncateAt(int $length)

Set the truncation length for request exception messages.

Boot-only. The global default persists for the worker lifetime across all coroutines; per-request truncation settings take precedence.

Parameters

int $length

Return Value

void

in RequestException at line 71
static void dontTruncate()

Disable truncation of request exception messages.

Boot-only. The global default persists for the worker lifetime across all coroutines; per-request truncation settings take precedence.

Return Value

void

in RequestException at line 79
bool report()

Prepare the exception message and set the summarized flag.

Return Value

bool

in RequestException at line 93
protected string prepareMessage(Response $response)

Prepare the exception message.

Parameters

Response $response

Return Value

string

in RequestException at line 115
static void flushState()

Flush all static state.

Return Value

void

bool ok()

Determine if the response code was 200 "OK" response.

Return Value

bool

bool created()

Determine if the response code was 201 "Created" response.

Return Value

bool

bool accepted()

Determine if the response code was 202 "Accepted" response.

Return Value

bool

bool noContent(int $status = 204)

Determine if the response code was the given status code and the body has no content.

Parameters

int $status

Return Value

bool

bool movedPermanently()

Determine if the response code was a 301 "Moved Permanently".

Return Value

bool

bool found()

Determine if the response code was a 302 "Found" response.

Return Value

bool

bool notModified()

Determine if the response code was a 304 "Not Modified" response.

Return Value

bool

bool badRequest()

Determine if the response was a 400 "Bad Request" response.

Return Value

bool

bool unauthorized()

Determine if the response was a 401 "Unauthorized" response.

Return Value

bool

bool paymentRequired()

Determine if the response was a 402 "Payment Required" response.

Return Value

bool

bool forbidden()

Determine if the response was a 403 "Forbidden" response.

Return Value

bool

in DeterminesStatusCode at line 100
bool notFound()

Determine if the response was a 404 "Not Found" response.

Return Value

bool

in DeterminesStatusCode at line 108
bool requestTimeout()

Determine if the response was a 408 "Request Timeout" response.

Return Value

bool

in DeterminesStatusCode at line 116
bool conflict()

Determine if the response was a 409 "Conflict" response.

Return Value

bool

in DeterminesStatusCode at line 124
bool unprocessableContent()

Determine if the response was a 422 "Unprocessable Content" response.

Return Value

bool

in DeterminesStatusCode at line 132
bool unprocessableEntity()

Determine if the response was a 422 "Unprocessable Content" response.

Return Value

bool

in DeterminesStatusCode at line 140
bool tooManyRequests()

Determine if the response was a 429 "Too Many Requests" response.

Return Value

bool

in RequestException at line 19
Response response()

Get the Saloon response.

Return Value

Response

in RequestException at line 30
PendingRequest pendingRequest()

Get the pending request.

Return Value

PendingRequest

in RequestException at line 38
int status()

Get the HTTP status code.

Return Value

int

in RequestException at line 46
string body()

Get the response body.

Return Value

string