feat: preserve task executor error types with associated errors - #36
Merged
Merged
Conversation
zerosnacks
force-pushed
the
feat/improve-error-handling
branch
from
September 22, 2026 22:21
eb0a33c to
c2d3e17
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves how Steda handles errors returned by reusable task executors.
Previously,
TaskExecutorimplementations effectively had to returnsteda::Error, which pushed downstream projects toward eagerly converting domain errors into Steda errors. In practice, that often meant flattening failures intoError::Other(error.to_string()), losing the original error type and source chain.This change gives
TaskExecutoran associated error type:This lets executors keep their own typed error enums and use ordinary
?internally.Error preservation
Steda also gains:
plus
Error::task(...), so downstream task errors can be preserved as real error sources instead of being stringified.A downstream executor can now look like:
with a single conversion into Steda at the outer boundary.
API scope
The closure-based
TaskHandlerAPI andTaskContext::step/step_keyedremainsteda::Result-based.This is intentional: making those APIs generic over arbitrary error types caused widespread type inference failures for normal closures that only return
Ok(...).So this change keeps the existing closure ergonomics while allowing reusable executors to preserve their domain error types.
Result
This gives downstream users a cleaner error boundary:
?;