Conversation
A 422 whose body cannot be parsed as a validation error (for example an HTML page from a gateway) surfaced as a raw Jackson parse exception and lost the status code and response body. Fall back to DoclingServeClientException, as for any other 4xx/5xx. Signed-off-by: Ashfaqbs <105435085+Ashfaqbs@users.noreply.github.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.
What
DoclingServeClient.getResponseparses every 422 body as aValidationError. If the body is not one (for example an HTML error page from a gateway or proxy in front of docling-serve), the parse failure escapes as a raw Jackson exception, and the status code and response body are lost.Change
If the 422 body cannot be parsed as a validation error, fall back to
DoclingServeClientExceptioncarrying the status code and body, the same as any other 4xx/5xx response. Real validation errors still throwValidationException.Tests
New
DoclingServeClientErrorResponseTests(WireMock, no container needed):ValidationExceptionDoclingServeClientExceptionwith status 422 and the bodyBefore the change the second test fails with
tools.jackson.core.exc.StreamReadException; after it, both pass.spotlessCheckreports no violations in the files touched here.Signed off per DCO.