Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Error Handlers versus Werkzeug Exceptions #175

mitsuhiko opened this Issue · 1 comment

3 participants


Currently you can only declare error handler for Werkzeug exceptions. That's pretty much the case because what is not raised as a Werkzeug HTTP exception can't be catched. However since Python 2.4 is currently in the process of being phased out we could now finally make exceptions actual response objects if we prefer so it would make sense to keep that in mind and provide catching not only by code but also by any kind of instance check.

This also affects Werkzeug.

Related feedback issues:


Perhaps I don't understand this issue, but maybe it should be closed. It seems like current flask versions allow error handlers for any kind of exception. By this I mean the following program runs without an error, there are all sorts of combinations and permutations which it doesn't test.

    import flask
    app = flask.Flask(__name__)

    def handle_500(x=None):
            print "Trapped a python Exception!"
            return "app trapped", 200

    def slash_view() :
            raise Exception("WTF?")

    c = app.test_client()
    resp = c.get('/')
    assert == "app trapped"
    assert resp.status_code == 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.