Skip to content

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

Open
@Panlq

Description

@Panlq

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions