File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
src/aws_durable_execution_sdk_python Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -182,15 +182,20 @@ def result(self) -> T | None:
182182
183183 if not checkpointed_result .is_existent ():
184184 msg = "Callback operation must exist"
185- raise CallbackError (msg )
185+ raise CallbackError (message = msg , callback_id = self . callback_id )
186186
187187 if (
188188 checkpointed_result .is_failed ()
189189 or checkpointed_result .is_cancelled ()
190190 or checkpointed_result .is_timed_out ()
191191 or checkpointed_result .is_stopped ()
192192 ):
193- checkpointed_result .raise_callable_error ()
193+ msg = (
194+ checkpointed_result .error .message
195+ if checkpointed_result .error and checkpointed_result .error .message
196+ else "Callback failed"
197+ )
198+ raise CallbackError (message = msg , callback_id = self .callback_id )
194199
195200 if checkpointed_result .is_succeeded ():
196201 if checkpointed_result .result is None :
Original file line number Diff line number Diff line change 1818)
1919from aws_durable_execution_sdk_python .context import Callback , DurableContext
2020from aws_durable_execution_sdk_python .exceptions import (
21- CallableRuntimeError ,
2221 CallbackError ,
2322 SuspendExecution ,
2423 ValidationError ,
@@ -172,7 +171,7 @@ def test_callback_result_failed():
172171
173172 callback = Callback ("callback5" , "op5" , mock_state )
174173
175- with pytest .raises (CallableRuntimeError ):
174+ with pytest .raises (CallbackError ):
176175 callback .result ()
177176
178177
@@ -231,7 +230,7 @@ def test_callback_result_timed_out():
231230
232231 callback = Callback ("callback_timeout" , "op_timeout" , mock_state )
233232
234- with pytest .raises (CallableRuntimeError ):
233+ with pytest .raises (CallbackError ):
235234 callback .result ()
236235
237236
You can’t perform that action at this time.
0 commit comments