app.js
This file
Path
examples/error/app.js
25 lines · 689 bytes · JavaScript
Last changed by
miscTj Holowaychukbefore adoption4f4987e
History of this fileTake it
The walk stopped after 200 commits: lines older than e675991 point at it.
fine with --version 0.2.4Tj Holowaychukbefore adoptione675991
lines 1–10why, one step back12/**3 * Module dependencies.4 */56var express = require('./../../lib/express');78var app = express.createServer();910app.get('/', function(req, res){miscTj Holowaychukbefore adoption4f4987e
lines 11–12why, one step back11 // Caught and passed down to the errorHandler middleware12 throw new Error('something broke!');fine with --version 0.2.4Tj Holowaychukbefore adoptione675991
lines 13–15why, one step back13});1415app.get('/next', function(req, res, next){miscTj Holowaychukbefore adoption4f4987e
lines 16–17why, one step back16 // We can also pass exceptions to next()17 next(new Error('oh no!'))fine with --version 0.2.4Tj Holowaychukbefore adoptione675991
lines 18–25why, one step back18});1920// The errorHandler middleware in this case will dump exceptions to stderr21// as well as show the stack trace in responses, currently handles text/plain,22// text/html, and application/json responses to aid in development23app.use('/', express.errorHandler({ dumpExceptions: true, showStack: true }));2425app.listen(3000);