Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dotflow/core/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _run_action(self, *args, task=None, **kwargs):
raise ExecutionWithClassError() from None

if attempt == self.retry:
raise last_exception from last_exception
raise last_exception from None

if task is not None:
task.retry_count += 1
Expand Down
15 changes: 15 additions & 0 deletions tests/core/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ def flaky_step():
self.assertEqual(len(statuses), 1)
self.assertEqual(statuses[0], TypeStatus.RETRY)

def test_retry_exception_does_not_chain_to_itself(self):
def always_fail():
raise ValueError("fail")

inside = Action(always_fail, retry=2, retry_delay=0)

try:
inside()
except ValueError as error:
self.assertIsNot(
error.__cause__,
error,
"Exception must not be its own __cause__ (circular chain)",
)

def test_backoff_does_not_mutate_retry_delay(self):
def always_fail():
raise RuntimeError("fail")
Expand Down
Loading