handle cash-in errors
This commit is contained in:
parent
48dd23c11d
commit
86adfd0a63
7 changed files with 40 additions and 24 deletions
|
|
@ -1,11 +1,14 @@
|
|||
const E = function generateError (name) {
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const E = function (name) {
|
||||
var CustomErr = function (msg) {
|
||||
this.message = msg
|
||||
this.message = msg || _.startCase(name)
|
||||
this.name = name
|
||||
Error.captureStackTrace(this, CustomErr)
|
||||
}
|
||||
CustomErr.prototype = Object.create(Error.prototype)
|
||||
CustomErr.prototype.constructor = CustomErr
|
||||
CustomErr.code = name
|
||||
|
||||
return CustomErr
|
||||
}
|
||||
|
|
@ -18,3 +21,4 @@ function register (errorName) {
|
|||
|
||||
register('BadNumberError')
|
||||
register('NoDataError')
|
||||
register('InsufficientFundsError')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue