Flask default error handler not being called

Viewed 12533

I have an errors.py module to map errors to templates. I was wanting to add a default error handler and came across: http://flask.pocoo.org/mailinglist/archive/2012/7/12/default-error-handler/#cbeb8809dc0da7133f14b99e16f31d6b

I'm using Blueprint to modularize things and the errors module has the following mappings:

@err.app_errorhandler(403)
def forbidden(e):
   return render_template('403.html'), 403

@err.app_errorhandler(500)
def serverError(e):
   return render_template('500.html'), 500

@err.app_errorhandler(Exception)
def defaultHandler(e):
   return render_template('defaultError.html'), e.code

The specific mappings (403, 500) work fine if I abort to them (or induce them naturally), but if I abort to anything else (404 etc.) the defaulHandler() is not invoked.

3 Answers
Related