Skip to content

Errors

The SDK treats HTTP application errors as exceptions after receiving the response. Transport failures use a separate exception type.

Status Exception Description
401 AuthenticationException missing, malformed, expired, revoked, or invalid credential
403 AuthorizationException missing scope or organization boundary violation
404 NotFoundException route-bound object missing or unavailable
422 ValidationException field validation, relationship, WIP, or lifecycle rule
429 RateLimitException per-credential request limit reached
other 4xx/5xx ApiException server-reported API failure
no response TransportException network/client failure

Validation errors

Laravel field errors are exposed through errors():

try {
    $client->tickets()->create($projectId, $request);
} catch (ValidationException $e) {
    foreach ($e->errors() as $field => $messages) {
        foreach ($messages as $message) {
            fprintf(STDERR, "%s: %s\n", $field, $message);
        }
    }
}

Business-rule 422 responses may contain only message. Do not require errors() to be non-empty.

Rate limit errors

catch (RateLimitException $e) {
    $seconds = $e->retryAfterSeconds();
}

The value is parsed from Retry-After if the header is seconds or an HTTP date.

Raw error details

ApiException exposes:

$e->statusCode();
$e->responseBody();
$e->decoded();

Do not write the decoded error into logs if it contains user-supplied content.