salix/loopback/util/user-error.js

15 lines
514 B
JavaScript
Raw Normal View History

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