- The global error class used to denote errors generated by jetta
- Instances contain unique error codes, making them easy to track throughout the codebase
- Designed with multi-language support, which helps non-English speakers trace errors
- Example:
const error = new jetta.JettaError('jetta-cookie-invalid-name', 'en')
const {message} = jetta.JettaError.getErrorMessage('jetta-cookie-invalid-name', 'en')
-
static jetta.JettaError.getErrorMessage(
code
STRING,preferredErrorLanguage
STRING[,details
OBJECT])-
Returns a human-readable error message in the form of an object
-
Used internally by
jetta.JettaError
instances -
code
STRING - a valid error code as used in jetta -
preferredErrorLanguage
STRING - as an ISO 639-1 code -
details
OBJECT - any details associated with the error -
return OBJECT
lang
STRING - as an ISO 639-1 code- The language used for the error message, may be
en
ifpreferredErrorLanguage
is not available
- The language used for the error message, may be
message
STRING - The localized message in the language denoted by instance.lang
-
-
new jetta.JettaError(
code
STRING,preferredErrorLanguage
STRING[,details
OBJECT])-
code
STRING - a valid error code as used in jetta -
preferredErrorLanguage
STRING - as an ISO 639-1 code -
details
OBJECT - any details associated with the error -
instance OBJECT
code
STRING - the unique error code for this particular JettaErrordetails
OBJECT - provides additional details to an error- A native
Error
or key-value object (e.g.details.algorithm
to denote which algorithm is wrong) - This is always an object - never
null
- A native
lang
STRING - as an ISO 639-1 code- The language used for the error message, may be
en
ifpreferredErrorLanguage
is not available
- The language used for the error message, may be
message
STRING - The localized message in the language denoted by instance.lang
-