Skip to content

Commit b6e53d7

Browse files
committed
docs: add more documentation regarding util.inspect
1 parent 88b9a58 commit b6e53d7

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,23 @@
66
[![Test Coverage][coveralls-image]][coveralls-url]
77
[![Gratipay][gratipay-image]][gratipay-url]
88

9-
Development-only error handler middleware
9+
Development-only error handler middleware.
10+
11+
This middleware is only intended to be used in a development environment, as
12+
the _full error stack traces and internal details of any object passed to this
13+
module_ will be sent back to the client when an error occurs.
14+
15+
When an object is provided to Express as an error, this module will display
16+
as much about this object as possible, and will do so by using content negoiation
17+
for the response between HTML, JSON, and plain text.
18+
19+
* When the object is a standard `Error` object, the string provided by the
20+
`stack` property will be returned in HTML/text responses.
21+
* When the object is a non-`Error` object, the result of
22+
[util.inspect](https://nodejs.org/api/util.html#util_util_inspect_object_options)
23+
will be returned in HTML/text responses.
24+
* For JSON responses, the result will be an object with all enumerable properties
25+
from the object in the response.
1026

1127
## Install
1228

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

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

3043
#### Options
3144

0 commit comments

Comments
 (0)