2018-12-27 11:54:16 +00:00
|
|
|
/**
|
|
|
|
* Class used for user-readable errors. All thrown errors of this
|
|
|
|
* class will be translated, propagated to the client and displayed to
|
|
|
|
* the final user, so they cannot contain sensitive data and must
|
|
|
|
* be understandable by people who do not have a technical profile.
|
|
|
|
*/
|
2024-01-03 07:06:20 +00:00
|
|
|
const SalixError = require('./salixError');
|
|
|
|
module.exports = class UserError extends SalixError {
|
2019-01-29 15:37:59 +00:00
|
|
|
constructor(message, code, ...translateArgs) {
|
2018-12-27 11:54:16 +00:00
|
|
|
super(message);
|
2024-01-03 07:06:20 +00:00
|
|
|
this.name = UserError.name;
|
2018-12-27 11:54:16 +00:00
|
|
|
this.statusCode = 400;
|
2019-01-29 15:37:59 +00:00
|
|
|
this.code = code;
|
2018-12-27 11:54:16 +00:00
|
|
|
this.translateArgs = translateArgs;
|
|
|
|
}
|
|
|
|
};
|