File tree Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -27,33 +27,22 @@ def __init__(self, message: str) -> None:
2727 super ().__init__ (
2828 message +
2929"""
30- This exception should be ignored in your code . If you see this exception:
30+ This exception is safe to ignore . If you see it, you might be using a try/catch all statement.
3131
32- * You might be using a try/catch all statement and logging afterwards. Don't do:
32+ Don't do:
3333try:
3434 # Code
3535except:
3636 # This catches all exceptions, including the SdkInternalBaseException!
37- traceback.print_exc() <- Prints this exception
3837
3938Do instead:
4039try:
4140 # Code
4241except TerminalError:
4342 # In Restate handlers you typically want to catch TerminalError only
4443
45- * To catch ctx.run/ctx.run_typed errors, check https://docs.restate.dev/develop/python/durable-steps#run for more details.
46-
47- * Only if you need to release/cleanup some resource, like a file,
48- use try/finally https://docs.python.org/3/tutorial/errors.html#defining-clean-up-actions,
49- or use restate.is_internal_exception to distinguish between an internal exception or not:
50-
51- try:
52- # Code
53- except TerminalError:
54- # Handle terminal error
55- finally:
56- # Perform cleanup
44+ Or remove the try/except altogether if you don't need it.
45+ For further info on error handling, refer to https://docs.restate.dev/develop/python/error-handling
5746""" )
5847
5948class SuspendedException (SdkInternalBaseException ):
Original file line number Diff line number Diff line change @@ -784,7 +784,8 @@ impl ErrorFormatter for PythonErrorFormatter {
784784 fn display_closed_error ( & self , f : & mut fmt:: Formatter < ' _ > , event : & str ) -> fmt:: Result {
785785 write ! ( f, "Execution is suspended, but the handler is still attempting to make progress (calling '{event}'). This can happen:
786786
787- * If you use catch all statements. Don't do:
787+ * If you use try/catch all statements.
788+ Don't do:
788789try:
789790 # Code
790791except:
797798except TerminalError:
798799 # In Restate handlers you typically want to catch TerminalError only
799800
800- * To catch ctx.run/ctx.run_typed errors, check https://docs.restate.dev/develop/python/durable-steps#run for more details.
801+ Or remove the try/except altogether if you don't need it.
802+ For further info on error handling, refer to https://docs.restate.dev/develop/python/error-handling
801803
802804* If you use the context after the handler completed, e.g. moving the context to another thread.
803805 Check https://docs.restate.dev/develop/python/concurrent-tasks for more details on how to create durable concurrent tasks in Python." )
You can’t perform that action at this time.
0 commit comments