Uh oh!
There was an error while loading. Please reload this page.
Allow TaskFailedError to be constructed from Exception - #99
Conversation
Uh oh!
There was an error while loading. Please reload this page.
| if self._exception is None: | ||
| raise ValueError('The task has not failed.') | ||
| return self._exception | ||
There was a problem hiding this comment.
Can we add another override here for failing a task that automatically takes in an Exception and handles all internal things needed by DurableTask to ensure that the failure is handled correctly?
Example:
deffail(self, ex: Exception):
self._is_complete=Trueself._exception=TaskFailedError(
"Error occured",
ex
)
ifself._parentisnotNone:
self._parent.on_child_completed(self)There was a problem hiding this comment.
I have updated the signature of CompletableTask.fail() to allow Exceptions as input, it'll handle things from there.
Choosing not to add an implementation of fail() to Task, as it violates the design of having CompletableTask vs CompositeTask. If an externally-defined class inheriting from CompositeTask needs to call fail(), it can double-inherit from CompletableTask (which more correctly describes the behavior of that task anyway).
Also improves new_failure_details to allow capturing inner exceptions