<#882 Surface subtask errors instead of confusing ...
# flyte-github
a
#882 Surface subtask errors instead of confusing TypeError in flyte.map Pull request opened by pingsutw Summary • When
flyte.map
returns exceptions as values (
return_exceptions=True
), user code that performs arithmetic on them (e.g.
sum(results)
) would get a confusing
TypeError: unsupported operand type(s) for +: 'int' and 'RetriesExhaustedError'
• Added numeric dunder methods (
__add__
,
__radd__
,
__sub__
,
__mul__
,
__truediv__
,
__floordiv__
and reverses) to
BaseRuntimeError
that re-raise the original subtask error instead Before: Screenshot 2026-03-31 at 12 21 27 AM After: Screenshot 2026-03-31 at 12 21 15 AM Test plan • Unit tests for all arithmetic dunder methods on
BaseRuntimeError
• Integration test:
flyte.map
with failing subtasks →
sum(results)
now surfaces the subtask error • Existing
test_mapping.py
and
test_map_concurrency.py
tests pass (19 total) flyteorg/flyte-sdk