Repository navigation
Add typed access to ApplicationError and CancelledError details - #2171
Open
prateek11rai wants to merge 1 commit into
Open
prateek11rai wants to merge 1 commit into
prateek11rai wants to merge 1 commit into
Conversation
details is now decoded when first read, and the new detail(index, type_hint) decodes one detail with a type hint. from_failure keeps the payloads and payload converter on the error instead of decoding them up front. Closes temporalio#1262 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Note
🤖
claude-opus-5-5on behalf of PrateekWhat was changed
Error details can now be read as your own type. Before, they always came back as plain values, so a dataclass detail was a
dict.ApplicationErrorandCancelledErrorgetdetail(index, type_hint)andraw_details(the detail payloads,Nonefor errors created locally).detailsis now decoded the first time it is read. It returns the same values as before.from_failurekeeps the payloads and the payload converter on the error instead of decoding them up front.detailsproperty moved there.I included
CancelledErrorbecause its details are decoded the same way.Not changed
TimeoutError.last_heartbeat_detailsis still decoded up front. It holds the activity's last heartbeat rather than error details, and #1262 is aboutApplicationError. It can follow the same pattern in a separate PR.Why?
#1262 asks for typed access to error details. Decoding when read also means one undecodable detail no longer loses the whole error (message, type,
non_retryable); only reading that detail raises. The Go SDK works the same way:err.Details(&v)decodes on call.Checklist
Closes [Bug] Add ability to obtain
ApplicationErrordetails with type hint #1262How was this tested:
New tests: round trips for both error types (typed read, decoded once,
raw_details,IndexError), a locally created error, an undecodable detail, a Pydantic model, and end-to-end tests where the workflow, the client, and an async-cancelled activity read typed details through an encryption codec.test_previous_run_outcome_decodes_with_nexus_contextnow readslast_failure.details, because the detail is no longer decoded just by rebuilding the error.Any docs updates needed?
Docstrings and
added/andchanged/changelog fragments. No README change: it only says anApplicationErrorcan include details. After a release, a short example of reading typed details on the Python error-handling page could help; I can open that docs PR.