Originally i intended to rewrite the error handling system to register
an error handler for each subclass of HTTPException on initialization
of the Flask object, removing the distinction between HTTP exceptions
and other exception types. However, with the current behavior of
preferring the first-registered handler when an error occurs, doing this
without compromises would require changing this to preferring the
last-registered handler, a backwards-incompatible change.
The following is a very minimal fix to only make Flask prioritize the
user's error handlers over others. I am not sure which performance
implications this has. Maybe a major rewrite of the error handling
system is still desirable (with more complex prioritization of
errorhandlers -- something based on "distance" in inheritance tree?),
but at the moment i don't see a reason to do so, given that the current
system is primitive enough to be understandable, while still usable.