Handling errors with proper JSON responses

Implementation inspired by...
- https://github.com/visionmedia/express/blob/master/examples/error/index.js
- http://www.hacksparrow.com/express-js-custom-error-pages-404-and-500.html