Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pd4d10/friendly-error
Show uncaught errors friendly in Node.js.
https://github.com/pd4d10/friendly-error
error-handling nodejs
Last synced: 5 days ago
JSON representation
Show uncaught errors friendly in Node.js.
- Host: GitHub
- URL: https://github.com/pd4d10/friendly-error
- Owner: pd4d10
- License: mit
- Created: 2017-01-16T01:08:01.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T11:40:48.000Z (about 6 years ago)
- Last Synced: 2024-07-04T16:07:26.199Z (4 months ago)
- Topics: error-handling, nodejs
- Language: JavaScript
- Homepage:
- Size: 1.03 MB
- Stars: 73
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# friendly-error
Show uncaught errors friendly in Node.js.
## Usage
```sh
npm install --save friendly-error
```Then add a line at the beginning of your entry file:
```js
require('friendly-error')()
```That's it.
It use Google, so make sure you have network access to Google. StackOverflow's search API seems not working as expected.
## Configuration
### Proxy
`friendly-error` support HTTP, HTTPS and SOCKS5 proxy.
```js
// HTTP proxy
// Just replace 'http://' with 'https://' to use HTTPS proxy
require('friendly-error')({
proxy: 'http://localhost:8080'
})// SOCKS5 proxy
require('friendly-error')({
proxy: 'socks5://localhost:1080'
})
```### Colors
If you don't like default colors, you could change it easily.
Default configuration is as follows:
```js
require('friendly-error')({
errorMessage: chalk.red, // Error message
errorStack: chalk.reset // Error stack
breakPoint: chalk.bgWhite.black, // Break point where error happens
answer: chalk.yellow // Best answer from stackoverflow
link: chalk.cyan.underline // Links
})
```Visit [chalk](https://github.com/chalk/chalk) for more information.
## License
MIT