lamassu-server/lib/error.js
Josh Harvey cd1e9bdb66 WIP
2016-05-04 18:34:12 +01:00

19 lines
406 B
JavaScript

const E = function generateError (name) {
var CustomErr = function (msg) {
this.message = msg
this.name = name
Error.captureStackTrace(this, CustomErr)
}
CustomErr.prototype = Object.create(Error.prototype)
CustomErr.prototype.constructor = CustomErr
return CustomErr
}
module.exports = E
function register (errorName) {
E[errorName] = E(errorName)
}
register('BadNumberError')