Skip to content

Commit e8c3c0f

Browse files
committed
Allow TaskFailedError to be constructed from Exception
1 parent a95501a commit e8c3c0f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

durabletask/task.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,10 @@ def stack_trace(self) -> Optional[str]:
302302
class TaskFailedError(Exception):
303303
"""Exception type for all orchestration task failures."""
304304

305-
def __init__(self, message: str, details: pb.TaskFailureDetails):
305+
def __init__(self, message: str, details: Union[pb.TaskFailureDetails, Exception]):
306306
super().__init__(message)
307+
if isinstance(details, Exception):
308+
details = pbh.new_failure_details(details)
307309
self._details = FailureDetails(
308310
details.errorMessage,
309311
details.errorType,

0 commit comments

Comments
 (0)