Uninett / zinolib

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

More information (eg. caseid) when zinolib does a traceback. #56

Closed runborg closed 2 months ago

runborg commented 3 months ago

Some times when zinolib does a traceback, it is interesting to get more information printed on what object created the traceback.

Here is an example:

[14:45:04] runarb@dlrunbor-17 /home/runarb/zino2
(zino-env) --> $ curitz -p local
Traceback (most recent call last):
  File "/home/runarb/.local/bin/curitz", line 8, in <module>
    sys.exit(main())
  File "/home/runarb/.local/pipx/venvs/curitz/lib/python3.10/site-packages/curitz/cli.py", line 1182, in main
    curses.wrapper(uiloop, config)
  File "/usr/lib/python3.10/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/runarb/.local/pipx/venvs/curitz/lib/python3.10/site-packages/curitz/cli.py", line 404, in uiloop
    runner(screen, config)
  File "/home/runarb/.local/pipx/venvs/curitz/lib/python3.10/site-packages/curitz/cli.py", line 678, in runner
    create_case_list(config)
  File "/home/runarb/.local/pipx/venvs/curitz/lib/python3.10/site-packages/curitz/cli.py", line 628, in create_case_list
    description=case.lastevent,
  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 'lastevent'

Is it possible to encapsulate more information to be printed, eg. the failing case number into these traceback messages? as it is now, i need to scan trough the database for the failing object to find the source of this traceback.

hmpf commented 3 months ago

If it is an uncaught exception (as is the case here) no.

This specific one we can catch and see if we can add a caseid to though.

hmpf commented 2 months ago

Fixed in 0.9.23.