Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow TaskFailedError to be constructed from Exception#99

Merged
andystaples merged 5 commits intomainmicrosoft/durabletask-python:mainfrom
andystaples/improve-task-failure-logicmicrosoft/durabletask-python:andystaples/improve-task-failure-logicCopy head branch name to clipboard
Jan 8, 2026
Merged

Allow TaskFailedError to be constructed from Exception#99
andystaples merged 5 commits intomainmicrosoft/durabletask-python:mainfrom
andystaples/improve-task-failure-logicmicrosoft/durabletask-python:andystaples/improve-task-failure-logicCopy head branch name to clipboard

Conversation

@andystaples
Copy link
Contributor

@andystaples andystaples commented Jan 7, 2026

Also improves new_failure_details to allow capturing inner exceptions

durabletask/internal/helpers.py Outdated Show resolved Hide resolved
if self._exception is None:
raise ValueError('The task has not failed.')
return self._exception

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

def fail(self, ex: Exception):
  self._is_complete = True
              self._exception = TaskFailedError(
                  "Error occured",
                  ex
              )
              if self._parent is not None:
                  self._parent.on_child_completed(self)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@andystaples andystaples merged commit e8b163e into main Jan 8, 2026
20 checks passed
@andystaples andystaples deleted the andystaples/improve-task-failure-logic branch January 8, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.