Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about how to handle errors #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ var err = new createError.NotFound()
|510 |NotExtended |
|511 |NetworkAuthenticationRequired|

## Handling the errors

If used with Express, the [default error handler](https://expressjs.com/en/guide/error-handling.html) will handle errors created using `http-errors` and respond with an appropriate HTML response. If you are developing an API and need to send and handle JSON responses, you might want to create your own error handler, or use a module like [`error-handler-json`](https://github.com/mifi/error-handler-json) (based on the unmaintained [`api-error-handler`](https://github.com/expressjs/api-error-handler) project.)

## License

[MIT](LICENSE)
Expand Down