From 4f38eaecc4dd54f268a011d8c4682979e98550d6 Mon Sep 17 00:00:00 2001 From: Rowan Manning Date: Fri, 27 Sep 2013 15:13:21 +0100 Subject: [PATCH] Add a stack trace to the 500 page in dev mode --- app.js | 3 +++ view/500.html | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 312b505..d93de6c 100644 --- a/app.js +++ b/app.js @@ -66,6 +66,9 @@ function initApp (config, callback) { app.express.use(function (err, req, res, next) { /* jshint unused: false */ app.emit('route-error', err); + if (process.env.NODE_ENV !== 'production') { + res.locals.error = err; + } res.status(500); res.render('500'); }); diff --git a/view/500.html b/view/500.html index 58e0cce..3165123 100644 --- a/view/500.html +++ b/view/500.html @@ -2,8 +2,10 @@

Eeek! 500 error. This is serious.

There isn't much you can do about this.

Give it another go or try the home page. -

Techy-stuff

-
<p>Sample text here...</p>
+ {{#if error}} +

Stack-Trace

+
{{error.stack}}
+ {{/if}}