Uninett / zinolib

Python library for zino
Apache License 2.0
1 stars 3 forks source link

More descriptive error messages on object has no attribute error #51

Open runborg opened 3 months ago

runborg commented 3 months ago

When the client requests an attribute that does not exist in the current case object it will fail with an error like this:

Traceback (most recent call last):
  File "/home/runarb/.local/pipx/venvs/curitz/lib/python3.10/site-packages/curitz/cli.py", line 565, in create_case_list
    port = case.bfdaddr
  File "/home/runarb/.local/pipx/venvs/curitz/lib/python3.10/site-packages/zinolib/ritz.py", line 309, in __getattr__
    self.__getattribute__(name)
AttributeError: 'Case' object has no attribute 'bfdaddr'

This AttributeError does not include any hints on the Case number in action when this error occurred. It would be nice to somehow add the case ID to the error, this to lessen the burden of debugging this case in the backend system. without available case id all cases needs to be inspected to find the affected case object.