chore: use monorepo organization
This commit is contained in:
parent
deaf7d6ecc
commit
a687827f7e
1099 changed files with 8184 additions and 11535 deletions
27
packages/server/lib/error.js
Normal file
27
packages/server/lib/error.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
const E = function (name) {
|
||||
var CustomErr = function (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
|
||||
}
|
||||
|
||||
module.exports = E
|
||||
|
||||
function register (errorName) {
|
||||
E[errorName] = E(errorName)
|
||||
}
|
||||
|
||||
register('BadNumberError')
|
||||
register('NoDataError')
|
||||
register('InsufficientFundsError')
|
||||
register('StaleTxError')
|
||||
register('RatchetError')
|
||||
register('NotImplementedError')
|
||||
Loading…
Add table
Add a link
Reference in a new issue