Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

3 Commits

Repository files navigation

@open-node/errors

make the error object with custom defines

Build statuscodecov

Installation

npm i @open-node/errors --save

Usage

  • your node.js process code
const Errors = require('@open-node/errors');
const defines = [
['yourErrorCode', 'Your error message, allow add variable, eg: %s']
['yourErrorCode2', 'Your error message, allow add variable, eg: %s, %d']
];
const errors = Errors(defines);
// usage in your code
try {
...
...
} catch (e) {
const error = errors.yourErrorCode(e.message); // returns error be instanceOf Error
writeErrorLog(error);
}

About

make the error object with custom defines

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages