Report non-retryable PayloadValidationError as BAD_REQUEST - #3009
Open
bergundy wants to merge 2 commits into
Open
Report non-retryable PayloadValidationError as BAD_REQUEST#3009bergundy wants to merge 2 commits into
bergundy wants to merge 2 commits into
Conversation
A data converter can signal that a Nexus operation's input is invalid by throwing a non-retryable ApplicationFailure of type PayloadValidationError while deserializing the input. Such a failure is now translated into a BAD_REQUEST HandlerException retaining the original failure as its cause, instead of the INTERNAL handler error any other application failure produces. Application failures of any other type, and retryable PayloadValidationError failures, 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 data converter can now signal that a Nexus operation's input is invalid by throwing a non-retryable
ApplicationFailureof typePayloadValidationErrorwhile deserializing the input.PayloadSerializertranslates such a failure into aBAD_REQUESTHandlerExceptionwith the messageinvalid operation input, retaining the original failure as its cause.Previously any
ApplicationFailurefrom the data converter propagated and was turned into anINTERNALhandler error byNexusTaskHandlerImpl, which callers retry — so a caller sending invalid input was retried until timeout instead of failing fast.Unchanged
ApplicationFailureof any other type → propagated as before (INTERNAL)PayloadValidationError→ propagated as before (INTERNAL); non-retryable is requiredHandlerExceptionfrom the converter → passed through untouchedInvalidProtocolBufferException/DataConverterException→BAD_REQUESTas beforeserialize()is untouched —BAD_REQUESTwould be wrong for a result-encoding failureTests
PayloadSerializerTest: positive case assertingBAD_REQUEST, non-retryable, the wrapper message and the preserved cause; negative cases for a different error type and for a retryablePayloadValidationError.OperationInputDeserializationErrorPropagationTest: end-to-end through the test server, including a retryable case that proves the non-retryable guard by being retried.Cross-SDK
Part of a coordinated change; equivalent PRs exist for Go, TypeScript, Python and .NET. The wrapper message wording is aligned across SDKs, adapted to each SDK's message style.