Skip to content

Commit 424797b

Browse files
committed
Pass failure details correctly
1 parent 4557c15 commit 424797b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

durabletask/internal/exceptions.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
import orchestrator_service_pb2 as pb
2+
3+
14
class VersionFailureException(Exception):
2-
pass
5+
def __init__(self, error_details: pb.TaskFailureDetails) -> None:
6+
super().__init__()
7+
self.error_details = error_details
38

49

510
class AbandonOrchestrationError(Exception):
6-
def __init__(self, *args: object) -> None:
7-
super().__init__(*args)
11+
pass

durabletask/worker.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,6 @@ def execute(
970970
)
971971

972972
ctx = _RuntimeOrchestrationContext(instance_id, self._registry)
973-
version_failure = None
974973
try:
975974
# Rebuild local state by replaying old history into the orchestrator function
976975
self._logger.debug(
@@ -992,8 +991,8 @@ def execute(
992991

993992
except pe.VersionFailureException as ex:
994993
if self._registry.versioning and self._registry.versioning.failure_strategy == VersionFailureStrategy.FAIL:
995-
if version_failure:
996-
ctx.set_failed(version_failure)
994+
if ex.error_details:
995+
ctx.set_failed(ex.error_details)
997996
else:
998997
ctx.set_failed(ex)
999998
elif self._registry.versioning and self._registry.versioning.failure_strategy == VersionFailureStrategy.REJECT:
@@ -1062,7 +1061,7 @@ def process_event(
10621061
f"Error action = '{self._registry.versioning.failure_strategy}'. "
10631062
f"Version error = '{version_failure}'"
10641063
)
1065-
raise pe.VersionFailureException
1064+
raise pe.VersionFailureException(version_failure)
10661065

10671066
# deserialize the input, if any
10681067
input = None

0 commit comments

Comments
 (0)