From b6e53d77a5d57e06447f92a6df4690c6978a3c25 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Sun, 6 Sep 2015 23:40:17 -0400 Subject: [PATCH] docs: add more documentation regarding util.inspect --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e1c9542..497fc7c 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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