Skip to main content

Class: OAuthError

Defined in: src/auth/errors.ts:308

OAuth error.

Remarks​

Thrown for OAuth 2.0 protocol errors. HTTP mapping: 400 Bad Request or 401 Unauthorized

See​

RFC 6749 Error Response

Extends​

Constructors​

new OAuthError()​

new OAuthError(oauthError, errorDescription?, errorUri?): OAuthError

Defined in: src/auth/errors.ts:341

Creates a new OAuthError.

Parameters​

oauthError​

OAuth error code

"invalid_request" | "invalid_client" | "invalid_grant" | "unauthorized_client" | "unsupported_grant_type" | "invalid_scope" | "access_denied" | "server_error"

errorDescription?​

string

Error description

errorUri?​

string

Documentation URI

Returns​

OAuthError

Overrides​

ChiveError.constructor

Properties​

cause?​

readonly optional cause: Error

Defined in: src/types/errors.ts:71

Original error that caused this error (if any).

Remarks​

Error chaining allows tracking the full error context through multiple layers of the application. Useful for debugging complex error scenarios.

Example​

try {
await fetchData();
} catch (err) {
throw new ValidationError('Failed to validate data', 'field', 'required', err as Error);
}

Inherited from​

ChiveError.cause


code​

readonly code: "OAUTH_ERROR" = 'OAUTH_ERROR'

Defined in: src/auth/errors.ts:309

Machine-readable error code.

Remarks​

Error codes are unique identifiers for error types, enabling programmatic error handling (switch statements, error maps), error tracking in monitoring systems, and client-side error translation (i18n).

Overrides​

ChiveError.code


errorDescription?​

readonly optional errorDescription: string

Defined in: src/auth/errors.ts:327

OAuth error description.


errorUri?​

readonly optional errorUri: string

Defined in: src/auth/errors.ts:332

OAuth error URI for documentation.


oauthError​

readonly oauthError: "invalid_request" | "invalid_client" | "invalid_grant" | "unauthorized_client" | "unsupported_grant_type" | "invalid_scope" | "access_denied" | "server_error"

Defined in: src/auth/errors.ts:314

OAuth error code per RFC 6749.