You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "uvloop/cbhandles.pyx", line 63, in uvloop.loop.Handle._run
File "...lib/python3.11/site-packages/nicegui/background_tasks.py", line 59, in _handle_task_result
globals.handle_exception(e)
File ".../lib/python3.11/site-packages/nicegui/globals.py", line 114, in handle_exception
result = handler() if not inspect.signature(handler).parameters else handler(exception)
^^^^^^^^^^^^^^^^^^
File ".../lib/python3.11/site-packages/nicegui/functions/notify.py", line 35, in notify
outbox.enqueue_message('notify', options, globals.get_client().id)
^^^^^^^^^^^^^^^^^^^^
File ".../lib/python3.11/site-packages/nicegui/globals.py", line 101, in get_client
return get_slot().parent.client
^^^^^^^^^^
File ".../lib/python3.11/site-packages/nicegui/globals.py", line 97, in get_slot
return get_slot_stack()[-1]
~~~~~~~~~~~~~~~~^^^^
IndexError: list index out of range
Going by the docs it's hard to say if this is a bug or a feature request. If the latter, as @groucho86 already suggested in #445, it would be nice to have a general mechanism to catch exceptions that works in async apps too. For now I am back to using the decorators that @smojef shared in #289.
Cheers, -Peter
The text was updated successfully, but these errors were encountered:
Thanks for reporting this bug, @kleynjan!
It took some time to get to the bottom of this issue. But apparently we didn't handle the exception for async callbacks in the right place, so the UI context got lost. The ui.timer already did it correctly. It should be fix with commit 9a4082b.
Description
In #445, Falko gives a minimal usage example of app.on_exception, but it doesn't work with async:
Apparently, the get_client() in globals fails:
Going by the docs it's hard to say if this is a bug or a feature request. If the latter, as @groucho86 already suggested in #445, it would be nice to have a general mechanism to catch exceptions that works in async apps too. For now I am back to using the decorators that @smojef shared in #289.
Cheers, -Peter
The text was updated successfully, but these errors were encountered: