Repository navigation
fix(state): forward @change listener exceptions to on_exception - #105
Merged
Merged
Conversation
Exceptions raised by @change listeners were only logged as a warning, and exceptions from async listeners never went through the state at all. They are now reported to the server's controller.on_exception (i.e. @life_cycle.exception), the same place RPC exceptions already go. - State accepts an exception_handler; child states use the root's handler - async listener tasks report their exception when they finish - fall back to the previous warning, now with a traceback, when no on_exception is registered or the handler fails - server state and context forward to the root controller.on_exception - example: add a change listener that raises - docs(readme): add development setup instructions
Coroutines registered with ctrl.xxx.add_task() run as detached tasks, so when they fail the error was only logged and never reached controller.on_exception (i.e. @life_cycle.exception). They are now reported there, like @change listener exceptions. - Controller accepts an exception_handler; child controllers use the root's handler - fall back to logging with a traceback when no on_exception is registered or the handler fails - failures of on_exception's own tasks are only logged to avoid loops - docs(readme): list change listeners and controller tasks under on_exception
Newer pytest-asyncio warns when this option is unset, and filterwarnings = ["error"] turns that warning into a startup failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exceptions raised by @change listeners were only logged as a warning, and exceptions from async listeners never went through the state at all. They are now reported to the server's controller.on_exception (i.e. @life_cycle.exception), the same place RPC exceptions already go.