mirror of
https://github.com/hanzoai/jose.git
synced 2026-09-24 17:00:01 +00:00
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]>
722 B
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.