Skip to content

Commit

Permalink
docs: add more documentation regarding util.inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Sep 7, 2015
1 parent 88b9a58 commit b6e53d7
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@
[![Test Coverage][coveralls-image]][coveralls-url]
[![Gratipay][gratipay-image]][gratipay-url]

Development-only error handler middleware
Development-only error handler middleware.

This middleware is only intended to be used in a development environment, as
the _full error stack traces and internal details of any object passed to this
module_ will be sent back to the client when an error occurs.

When an object is provided to Express as an error, this module will display
as much about this object as possible, and will do so by using content negoiation
for the response between HTML, JSON, and plain text.

* When the object is a standard `Error` object, the string provided by the
`stack` property will be returned in HTML/text responses.
* When the object is a non-`Error` object, the result of
[util.inspect](https://nodejs.org/api/util.html#util_util_inspect_object_options)
will be returned in HTML/text responses.
* For JSON responses, the result will be an object with all enumerable properties
from the object in the response.

## Install

Expand All @@ -23,9 +39,6 @@ var errorhandler = require('errorhandler')
### errorhandler(options)

Create new middleware to handle errors and respond with content negotiation.
This middleware is only intended to be used in a development environment, as
the full error stack traces will be sent back to the client when an error
occurs.

#### Options

Expand Down

0 comments on commit b6e53d7

Please sign in to comment.