1.0.3 • Published 3 years ago
error_reformer v1.0.3
Error Reformer
Introduction:
Customize standard node error to more detailed and easy JSON structure.
Tech Stack:
- Node JS
Dependencies:
- lodash
- logger
Exports :
1. emitError :
Use this function in catch block to handle error.
const someFunction = () => {
try {
# try block
} catch (err) {
emitError(err);
}
};
2. ServerError :
It is a class build on error class of node.js. Use this class to build your custom errors.
const someFunction = () => {
try {
throw new ServerError(name, message, stack, severity);
} catch (err) {
emitError(err);
}
};
3. errorEvents :
Use this custom event instance to listen for reformed errors on topic 'reformed_error'.
errorEvents.on("reformed_error", (val) => {
# handle it here
});