salix/loopback/util/user-error.js

17 lines
598 B
JavaScript

/**
* 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.
*/
const SalixError = require('./salixError');
module.exports = class UserError extends SalixError {
constructor(message, code, ...translateArgs) {
super(message);
this.name = UserError.name;
this.statusCode = 400;
this.code = code;
this.translateArgs = translateArgs;
}
};