title: Catching a 500 server error in Flask
body: <p>I love Flask's error catching.  It's beautifully simple:</p>
  
  <pre><code>@app.errorhandler(404)
  def pageNotFound(error):
      return "page not found"
  </code></pre>
  
  <p>works like charm.  But it doesn't work for the 500 error code.  I want to catch Python errors when something goes wrong an exception is raised in the code.  Is that possible?</p>
  
  <p>I should note that if I explicitly call <code>return abort(500)</code> in a view then the 500 errorhandler does work.  So this is explicitly for when the Python code fails.</p>
  
  <p>Is this possible?</p>