summaryrefslogtreecommitdiff
path: root/week-7/Final4/blog/routes/error.js
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-20 21:47:20 -0700
committermo khan <mo@mokhan.ca>2015-02-20 21:47:20 -0700
commitfe7e28edee40691d8b1189769a9b1b9939686d77 (patch)
treea8a57e33369da7f4d6b5267c082fd6644974686f /week-7/Final4/blog/routes/error.js
parentbd663082a8b29b02a98b52fe384cfbde18bedf73 (diff)
add final 3 and 4 validation scripts.
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 });
+}