Handle empty deque on errorhandler lookup.

After registering a custom errorhandler by exception class, raising any
unhandled exception in a view function swallows the error and instead
throws an `IndexError` on trying to look up the appropriate handler.
This patch avoids the uninformative `IndexError` and preserves the
original exception by looping until the deque of classes is empty, not
forever.
This commit is contained in:
Joshua Carp 2015-06-02 16:13:30 -04:00
parent 0d19fa0a06
commit 348bf52188
2 changed files with 30 additions and 1 deletions

View file

@ -1421,7 +1421,7 @@ class Flask(_PackageBoundObject):
# __mro__
done = set()
while True:
while queue:
cls = queue.popleft()
if cls in done:
continue