0.3.0 • Published 3 years ago
@open-node/errors v0.3.0
@open-node/errors
make the error object with custom defines
Installation
Usage
- your node.js process code
const defines = [ 'yourErrorCode', 'Your error message, allow add variable, eg: %s' ]; const errors = Errors(defines);
// usage in your code try { ... ... } catch (e) { const error = errors.yourErrorCode(e.message); // returns error be instanceOf Error writeErrorLog(error); }