summaryrefslogtreecommitdiff
path: root/week-7/Final4/blog/routes/error.js
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-21 20:55:43 -0700
committermo khan <mo@mokhan.ca>2015-02-21 20:55:43 -0700
commitb3cea2d8f1c0436e8be1f45b09f6c0fe42f7fb2a (patch)
tree1a4c02b1a09d923a60542b9ca6f366c04d298584 /week-7/Final4/blog/routes/error.js
parent8419ce131f9d933339495c12a644ac6ff747f116 (diff)
final 4.
Diffstat (limited to 'week-7/Final4/blog/routes/error.js')
-rw-r--r--week-7/Final4/blog/routes/error.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/week-7/Final4/blog/routes/error.js b/week-7/Final4/blog/routes/error.js
new file mode 100644
index 0000000..f50f2b6
--- /dev/null
+++ b/week-7/Final4/blog/routes/error.js
@@ -0,0 +1,9 @@
+// Error handling middleware
+
+exports.errorHandler = function(err, req, res, next) {
+ "use strict";
+ console.error(err.message);
+ console.error(err.stack);
+ res.status(500);
+ res.render('error_template', { error: err });
+}