2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/common/errors.js
2018-07-18 00:59:18 +05:30

36 lines
655 B
JavaScript

class BaseError extends Error {
constructor(statusCode, ...params) {
super(...params);
this.statusCode = statusCode;
}
}
class ValidationError extends BaseError {
constructor(...params) {
super(417, ...params);
}
}
class NotFound extends BaseError {
constructor(...params) {
super(404, ...params);
}
}
class Forbidden extends BaseError {
constructor(...params) {
super(403, ...params);
}
}
class ValueError extends ValidationError { }
class Conflict extends ValidationError { }
module.exports = {
ValidationError,
ValueError,
Conflict,
NotFound,
Forbidden
}