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
Specific error type
message
string
Error message
cause?
Error
Original error
Returns
Overrides
Properties
cause?
readonlyoptionalcause: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
code
readonlycode:"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
tokenError
readonlytokenError:TokenErrorType
Defined in: src/auth/errors.ts:43
Specific token error type.