def-err
v0.1.1
Published
define custom error, extendable
Downloads
3
Readme
Define Custom Error
only support es6
Usage
const defErr = require('def-err');
const BusinessError = defErr('BusinessError', '发生业务错误了', ['code', 'message']);
const HttpError = defErr('HttpError', '发生了Http错误', ['status', 'response']);
new BusinessError('miss_arguments', '参数缺失了,请检查是否缺少XX参数');
new HttpError('404', '找不到资源');