Report non-retryable PayloadValidationError as BAD_REQUEST - #1756
Open
bergundy wants to merge 2 commits into
Open
Report non-retryable PayloadValidationError as BAD_REQUEST#1756bergundy wants to merge 2 commits into
bergundy wants to merge 2 commits into
Conversation
A payload codec or payload converter can signal that a Nexus operation's input is invalid by raising a non-retryable ApplicationError of type PayloadValidationError while decoding the input. Such an error is now translated into a BAD_REQUEST HandlerError retaining the original error as its cause, instead of the INTERNAL handler error any other application error produces. Application errors of any other type, and retryable PayloadValidationError errors, keep their existing behavior.
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.
What changed
A payload codec or payload converter can now signal that a Nexus operation's input is invalid by raising a non-retryable
ApplicationErrorof typePayloadValidationErrorwhile decoding the input. Such an error is translated into aBAD_REQUESTnexusrpc.HandlerErrorwith the messageInvalid operation input, retaining the original error as its__cause__.Previously such an error became an
INTERNALhandler error on the codec path, which callers retry — so a caller sending invalid input was retried until timeout instead of failing fast. On the converter path the type was alreadyBAD_REQUEST, but the message was indistinguishable from a genuine decode failure; it now gets its own message.Unchanged
ApplicationErrorof any other type →INTERNALon the codec path (as before)PayloadValidationError→INTERNAL(non-retryable is required)BAD_REQUESTwould be wrong for a result-encoding failureTests
tests/nexus/test_workflow_caller_errors.pycovers both the codec and converter stages: positive unit cases assertingBAD_REQUEST, not retryable, the wrapper message and the preserved cause; negative cases for a different error type and for a retryablePayloadValidationError; plus an end-to-end test asserting the caller sees a non-retryableBAD_REQUESTwith anApplicationErrorcause.Cross-SDK
Part of a coordinated change; equivalent PRs exist for Go, Java, TypeScript and .NET. The wrapper message wording is aligned across SDKs, adapted to each SDK's message style.