Skip to main content

Class: TokenValidationError

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

Token validation error.

Remarks

Thrown when JWT validation fails. HTTP mapping: 401 Unauthorized

Extends

Extended by

Constructors

new TokenValidationError()

new TokenValidationError(tokenError, message, cause?): TokenValidationError

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

Creates a new TokenValidationError.

Parameters

tokenError

TokenErrorType

Specific error type

message

string

Error message

cause?

Error

Original error

Returns

TokenValidationError

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: "TOKEN_VALIDATION_ERROR" = 'TOKEN_VALIDATION_ERROR'

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

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


tokenError

readonly tokenError: TokenErrorType

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

Specific token error type.