You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
563 B
23 lines
563 B
/**
|
|
* Error whose message is a translation key.
|
|
* @augments Error
|
|
*/
|
|
class TranslatableError extends Error {
|
|
/**
|
|
* Indicates that the error message is a translation key.
|
|
*/
|
|
msgi18n = true;
|
|
|
|
/**
|
|
* Create a TranslatableError.
|
|
* @param {string} key - Translation key present in src/lang/en.json
|
|
* @param {object} meta Arbitrary metadata
|
|
*/
|
|
constructor(key, meta = {}) {
|
|
super(key);
|
|
this.meta = meta;
|
|
Error.captureStackTrace(this, this.constructor);
|
|
}
|
|
}
|
|
module.exports = TranslatableError;
|