Class: OAuthError
Defined in: auth-core/src/oauth.ts:174
Structured OAuth 2.x error with an RFC 6749 error code.
Expected (@ttoss/errors): it is a protocol response the server chose to
send, so it is kept out of error tracking. That holds for server_error
too — the fault behind it is the error you caught and should report there,
before answering with this.
Extends
ExpectedError<OAuthErrorCode>
Constructors
Constructor
new OAuthError(
args):OAuthError
Defined in: auth-core/src/oauth.ts:177
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { code: "invalid_request" | "invalid_client" | "invalid_grant" | "unsupported_grant_type" | "access_denied" | "server_error"; description: string; } | - |
args.code | "invalid_request" | "invalid_client" | "invalid_grant" | "unsupported_grant_type" | "access_denied" | "server_error" | RFC 6749 error value, exposed as code. |
args.description | string | Human-readable error_description. |
Returns
OAuthError
Overrides
ExpectedError<OAuthErrorCode>.constructor
Properties
code
readonlycode:"invalid_request"|"invalid_client"|"invalid_grant"|"unsupported_grant_type"|"access_denied"|"server_error"
Defined in: errors/src/index.ts:103
A subclass narrows it through the type parameter, e.g.
extends ExpectedError<'CARD_DECLINED' | 'CARD_EXPIRED'>.
Inherited from
ExpectedError.code
expected
readonlyexpected:true
Defined in: errors/src/index.ts:97
The discriminant isExpectedError reads. A marker rather than
instanceof because a bundler may inline its own copy of this class, and
an error thrown from that copy is not an instance of yours.
Inherited from
ExpectedError.expected
messageRef?
optionalmessageRef?:MessageRef
Defined in: errors/src/index.ts:112
Mutable: a boundary may attach it before rendering.
Inherited from
ExpectedError.messageRef
name
name:
string='OAuthError'
Defined in: auth-core/src/oauth.ts:175
Overrides
ExpectedError.name
values
readonlyvalues:ExpectedErrorValues|undefined
Defined in: errors/src/index.ts:109
A subclass narrows it per code through the type parameter, so the placeholders its copy interpolates are a checked contract.
Inherited from
ExpectedError.values