title: How can I debug a Flask application that has a custom exception handler?
body: <p>I would like to implement an exception handler for my Flask application that displays a custom error page when an <code>Exception</code> is thrown. I can get this working easily with</p>
  
  <pre><code>@application.errorhandler(Exception)
  def http_error_handler(error):
      return flask.render_template('error.html', error=error), 500
  </code></pre>
  
  <p>but this has the side effect of catching all exceptions before they hit the debugger (either the Werkzeug debugger or my IDE's) so that debugging is effectively disabled.</p>
  
  <p>How can I implement a custom exception handler that still allows be to debug exceptions and errors? Is there a way to disable my custom handler when in debug mode?</p>