title: How to Handle Errors in Node.js using Express
body: <p>I am working with a partner on a project. He has written a lot of code in Node.js+Express, but we've been running into issues with the architecture.</p>
  
  <p>To remedy this, my primary role has been to figure out the best way to architect a Node.js+Express application. I've run into two scenarios, dealing with errors, and I'd like some suggestions.</p>
  
  <p>First, how do I capture top-level exceptions? The last thing I want is for a bug to completely kill the node process. I want to continue serving users in the face of any error.</p>
  
  <p>Secondly, some errors are passed back via callbacks (we're using <a href="https://github.com/caolan/async" rel="noreferrer">caolan / async</a>). As part of each route handler, either we render a view (GET), redirect to another route (POST) and we want to redirect to an error screen with a custom error message. How can I make sure to capture this logic <strong>in one place</strong>?</p>