https://github.com/netcode/better-errors
better Nodejs error
https://github.com/netcode/better-errors
Last synced: about 1 year ago
JSON representation
better Nodejs error
- Host: GitHub
- URL: https://github.com/netcode/better-errors
- Owner: netcode
- License: mit
- Created: 2020-10-07T14:06:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T12:37:20.000Z (over 5 years ago)
- Last Synced: 2025-04-20T00:48:06.996Z (about 1 year ago)
- Language: JavaScript
- Size: 1.14 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# better-errors
Better Nodejs error is a small nodejs package to render errors in a better way to make it easy for you to identify errors and fix it fast.



## Installation
Install with npm:
```
$ npm install better-errors
```
## Usage and Examples
1. Unhandled Exception
Require `better-errors` on your code and it will catch the unhandled errors and render it.
```
require('better-errors')
```
2. Handled Exception
Import the `BetterError` function and use it to render errors
```js
const { BetterError } = require('better-errors');
//...
try{
functionCall()
}catch(error){
console.log(BetterError(error));
}
```
## Show stacktrace
Stacktrace is hidden by default tro reduce confusion, if you want to show the stacktrace just add `--show-stack` argument to node starting command.
```
$ node index.js --show-stack
```
## Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## License
Distributed under the MIT License. See `LICENSE` for more information.