merror-meetin
v1.1.3
Published
custom error with code
Downloads
4
Readme
Example
err_code.js
const code = {
INVALID_PRODUCT_ID: {
code: 3469,
message: '非法的商品ID'
}
};
module.exports = code;
index.js
const ErrCode = './err_code';
const MError = require('merror-meetin');
MError.configErrorCode(ErrCode);
const err = new MError(ErrCode.INVALID_PRODUCT_ID);
console.log('code', err.code, err.debugMessage, err.message);
Read codes in test
for more information.