catch exceptions in routes.js