Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception handler: Why find a potential handler doesn't exit the loop #911

Open
Panlq opened this issue Dec 9, 2022 · 0 comments · May be fixed by #913
Open

Exception handler: Why find a potential handler doesn't exit the loop #911

Panlq opened this issue Dec 9, 2022 · 0 comments · May be fixed by #913

Comments

@Panlq
Copy link

Panlq commented Dec 9, 2022

handler = potential_handler

  1. Why find a potential handler doesn't exit the loop?
  2. if not isinstance(exception, potential_handler.exclude):

potential_handler
The handler may just be a function that does not call hug.exception(SomeException, potential_handler) injects the handle
And it is directly called http.add_exception_handler method to inject an exception handler
This situation results in an AttributeError

  File "/root/.cache/pypoetry/virtualenvs/xxxx-CoXUkZCy-py3.8/lib/python3.8/site-packages/hug/interface.py", line 919, in __call__
    if not isinstance(exception, potential_handler.exclude):
AttributeError: 'function' object has no attribute 'exclude'

Whether it is necessary to increase robustness? like:

if hasattr(potential_handler, "exclude") and isinstance(exception, potential_handler.exclude):
   continue
Panlq pushed a commit to Panlq/hug that referenced this issue Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant