@jfabello/common-errors
v1.0.0
Published
Common error classes for Node.js.
Downloads
96
Readme
Node.js Common Errors Classes
A simple Node.js module that provides common error classes.
Table of Contents
Installation
You can install this module via npm:
npm install @jfabello/common-errors
Usage
After installation, import the module and use the common errors classes in your application:
const commonErrors = require("@jfabello/common-errors");
try {
// Some code that may fail
} catch (error) {
if (error.code === "EACCES") {
// Handle this known error
} else {
// Throw the ERROR_UNKNOWN common error
throw new commonErrors.ERROR_UNKNOWN();
}
}
Common Errors Classes
The following common errors classes are available:
| Error class | Description |
| --------------- | ------------- |
| ERROR_UNKNOWN
| Unknown error |
Contributing
Unfortunately, we are not able to accept contributions at this time.
If you find a bug in the code, please open an issue.
Thank you for your understanding.
License
This project is licensed under the MIT License. See the LICENSE file for details.