WorkOS PHP SDK

RateLimitExceededException extends BaseRequestException
in package

Thrown when the WorkOS API returns HTTP 429 (Too Many Requests).

If the response includes a Retry-After header, its parsed value (in seconds) is exposed on self::$retryAfter so callers can implement backoff.

Table of Contents

Properties

$error  : string|null
$errorCode  : string|null
$rawBody  : array<string|int, mixed>|null
$requestId  : string|null
$retryAfter  : int|null
Seconds to wait before retrying, parsed from the `Retry-After` response header. Null if the header was absent or unparseable.
$statusCode  : int|null

Methods

__construct()  : mixed
fromResponse()  : static
Build an exception of the called class from a parsed JSON error response.

Properties

$errorCode read-only

public string|null $errorCode = null

$rawBody read-only

public array<string|int, mixed>|null $rawBody = null

$requestId read-only

public string|null $requestId = null

$retryAfter

Seconds to wait before retrying, parsed from the `Retry-After` response header. Null if the header was absent or unparseable.

public int|null $retryAfter = null

$statusCode read-only

public int|null $statusCode = null

Methods

__construct()

public __construct([string $message = '' ][, int|null $statusCode = 429 ][, string|null $requestId = null ][, Throwable|null $previous = null ][, string|null $errorCode = null ][, string|null $error = null ][, array<string, mixed>|null $rawBody = null ][, int|null $retryAfter = null ]) : mixed
Parameters
$message : string = ''

Human-readable error message, sourced from the response body's message field when present.

$statusCode : int|null = 429

HTTP status code of the error response.

$requestId : string|null = null

Value of the X-Request-ID response header, if any. Useful when reporting issues to WorkOS support.

$previous : Throwable|null = null

Previous throwable (e.g. the underlying Guzzle exception).

$errorCode : string|null = null

Machine-readable code from the response body's code field.

$error : string|null = null

Short error identifier from the response body's error field.

$rawBody : array<string, mixed>|null = null

Full decoded JSON error body. See ApiException::__construct.

$retryAfter : int|null = null

Seconds to wait before retrying.

fromResponse()

Build an exception of the called class from a parsed JSON error response.

public static fromResponse(int $statusCode, array<string, mixed> $body[, string|null $requestId = null ]) : static
Parameters
$statusCode : int

HTTP status code.

$body : array<string, mixed>

Decoded JSON response body.

$requestId : string|null = null

Value of the X-Request-ID header, if any.

Return values
static
On this page

Search results