@darkwolf/code-error
v13.21.69
Published
Code Error
Downloads
80
Readme
Code Error
Install
npm i --save @darkwolf/code-error
Usage
const CodeError = require('@darkwolf/code-error')
class DarkwolfError extends CodeError {
constructor(...args) {
super(...args)
this.name = 'DarkwolfError'
}
}
const INVALID_DARKWOLF_ID = new DarkwolfError('invalid-darkwolf-id', 'Invalid Darkwolf ID')
try {
throw INVALID_DARKWOLF_ID
} catch (e) {
switch (e.code) {
case 'invalid-darkwolf-id': {
break
}
default: throw e
}
}