Skip to content

pd4d10/friendly-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

friendly-error

Show uncaught errors friendly in Node.js.

Demo

Usage

npm install --save friendly-error

Then add a line at the beginning of your entry file:

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.

// 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:

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 for more information.

License

MIT

About

Show uncaught errors friendly in Node.js.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published