Files
Filip Skokan abec502715 refactor(types): add discriminated JOSE error types
Pair each JOSE error subclass with its stable code so code switches can
narrow safely without closing subclass code values.

Share typed causes and reasons across JWT claim-validation errors, and
make consumer-created multiple-match errors safely iterable. Add
compile-time coverage for the public type surface.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00

722 B

Class: JOSEError

💗 Help the project

Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by becoming a sponsor.

A generic Error that all other JOSE specific Error subclasses extend.

Example

Checking thrown error is a JOSE one

if (err instanceof jose.errors.JOSEError) {
  // ...
}

Properties

code

• code: string = 'ERR_JOSE_GENERIC'

A unique error code for JOSEError. Each subclass sets its own; see AnyJOSEError to switch over them as a discriminated union.