Skip to Content

PublicApiError

An expected request failure whose message is intentionally safe to return in a public API. Authentication or admin authorization does not make an operational error safe to disclose.

Extends

  • Error

Extended by

Constructors

Constructor

protected new PublicApiError(__namedParameters): PublicApiError;

Parameters

__namedParameters

PublicApiErrorOptions

Overrides

Error.constructor

Properties

[PUBLIC_API_ERROR]

readonly [PUBLIC_API_ERROR]: true = true;

code

readonly code: | "INVALID_REQUEST" | "UNAUTHENTICATED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "USAGE_LIMIT_EXHAUSTED" | "SERVICE_UNAVAILABLE";

param

readonly param: string | null;

reason

readonly reason: | ApiErrorReason | null;

requiredPermission

readonly requiredPermission: | ResourceKindPermission | null;

The permission an admin API key lacks, with a FORBIDDEN code.


retryAfterSeconds

readonly retryAfterSeconds: number | null;

How many whole seconds a client waits before retrying, with a RATE_LIMITED code. The JSON envelope does not carry it: the server that answers sets the Retry-After header from it, for example with apiErrorResponse(body, { retryAfterSeconds: error.retryAfterSeconds }).


status

readonly status: PublicApiErrorStatus;
Last updated on