Closed zackw closed 6 years ago
Please test this against master, the error handler code has changed.
I'm having this same problem. The lookup seems to be happening by code only and not by class. I have a generic Exception handler too but it's not invoked either.
(Pdb) self.error_handler_spec.get(request.blueprint, {})
{None: {<class 'werkzeug.exceptions.HTTPException'>: <function handle_http_exception at 0x7fb4f99962f0>, <class 'Exception'>: <function handle_exception at 0x7fb4f9996268>}}
And does it happen on master?
I'm pulling down master now. Report shortly
It works on latest master
Thanks for testing it out, really appreciate this kind of help.
Happy to help! When can we expect a release?
Soon™
Expected Behavior
The documentation leads me to believe that an error handler registered like so:
... should be called for any HTTP error. (The requirement to set TRAP_HTTP_EXCEPTIONS is inadequately clear, but that's an unrelated problem.)
Actual Behavior
Instead, this configuration causes any HTTP error to turn into a 500 internal server error with this traceback:
I dug around in the debugger a little: this is from the perspective of the
handle_user_exception
frame:My application does not use blueprints, so the outer None in this structure is correct, and
_find_error_handler
understands it. However, the inner None does not correspond to any HTTP code, and so_find_error_handler
is unable to pass through that layer of nesting and do the intended lookup by class.Environment