The errorHandler middleware responds to exceptions passed or caught from within middleware above it, according to the options shown below.
connect.createServer(
function(req, res, next){
throw new Error('ahhhh!');
},
connect.errorHandler({ dumpExceptions: true })
);
By default the response of errorHandler is 500 'Internal Server Error'. If showStack is true, then Connect decides how to respond based on the Accept request header:
text/html Outputs an html version of the stack trace
application/json Outputs json { 'error': { 'message': ... }}
otherwise Outputs plain text stack trace
showMessage Show the exception message only
showStack Show the exception message and stack trace
dumpExceptions Output exception stack traces to stderr (does not re-throw)
--showErrorMessage
--showErrorStack
--dumpExceptions