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
write!(f,"Execution is suspended, but the handler is still attempting to make progress (calling '{event}'). This can happen:
763
763
764
-
* If the SuspendedException is caught. Make sure you NEVER catch the SuspendedException, e.g. avoid:
764
+
* If you don't need to handle task cancellation, just avoid catch all statements. Don't do:
765
765
try:
766
766
# Code
767
767
except:
768
-
# This catches all exceptions, including the SuspendedException!
768
+
# This catches all exceptions, including the asyncio.CancelledError!
769
+
# '{event}' <- This operation prints this exception
769
770
770
-
And use instead:
771
+
Do instead:
771
772
try:
772
773
# Code
773
774
except TerminalException:
774
-
# In Restate handlers you typically want to catch TerminalException
775
+
# In Restate handlers you typically want to catch TerminalException only
775
776
776
-
Check https://docs.restate.dev/develop/python/durable-steps#run for more details on run error handling.
777
+
* To catch ctx.run/ctx.run_typed errors, check https://docs.restate.dev/develop/python/durable-steps#run for more details.
777
778
778
-
* If you use the context after the handler completed, e.g. moving the context to another thread. Check https://docs.restate.dev/develop/python/concurrent-tasks for more details on how to create durable concurrent tasks in Python.")
779
+
* If the asyncio.CancelledError is caught, you must not run any Context operation in the except arm.
780
+
Check https://docs.python.org/3/library/asyncio-task.html#task-cancellation for more details on task cancellation.
781
+
782
+
* If you use the context after the handler completed, e.g. moving the context to another thread.
783
+
Check https://docs.restate.dev/develop/python/concurrent-tasks for more details on how to create durable concurrent tasks in Python.")
0 commit comments