@memotechs/exception
v1.0.5
Published
memotechs exception library
Downloads
11
Readme
Error Exception NPM Package
Overview
The Error Exception npm package is a lightweight and versatile library for handling errors and exceptions in Node.js applications. It provides a set of tools and utilities to make error management more efficient and organized, helping developers to write more robust and reliable code.
Compatibility
| Error Exception Version | Node.js Compatibility | | ------------------------ | ---------------------- | | 1.0.5 | 20.x | | <= 1.0.4 | 12.x |
This version of the Error Exception npm package is designed to be used exclusively with Node.js version 12. Please ensure that your project is using Node.js 12 or a compatible version before integrating this package.
Installation
To install the Error Exception npm package, use the following npm command:
npm i @memotechs/exception
Getting Started
Once installed, you can use the Error Exception package in your NestJS application by register it at main.ts:
import { HttpExceptionFilter } from '@memotechs/exception';
...
app.useGlobalFilters(new HttpExceptionFilter());
...
In your code section:
import { BusinessException } from '@memotechs/exception';
import { HttpStatus } from '@nestjs/common';
const options: ExceptionOptions = {
errorCode: 'SAMPLE_ERROR_CODE',
httpCode: HttpStatus.BAD_REQUEST,
message: 'Sample error message',
additionalData: { key: 'value' },
};
throw new BusinessException(options);
Or
import { BadRequestErrorException } from '@memotechs/exception';
import { HttpStatus } from '@nestjs/common';
throw new BadRequestErrorException({
errorCode: 'SAMPLE_ERROR_CODE',
httpCode: HttpStatus.BAD_REQUEST,
message: 'Sample error message',
additionalData: { key: 'value' },
});
Contributing
If you encounter any issues or have suggestions for improvements, feel free to open an issue on the GitHub repository. Contributions are welcome!
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgments
Thanks to the Node.js community for providing a robust and powerful platform for server-side JavaScript development. Special thanks to the contributors of the Error Exception npm package for their efforts in creating and maintaining this useful tool. Contact For any questions or inquiries, please contact the project maintainers:
Maintainers
Maintainer 1
- Name: Mesa SOT
- Email: [email protected]
Maintainer 2
- Name: Sopheak TE
- Email: [email protected]