-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue-1438: Fix upstream service error represented as 400 #1570
Issue-1438: Fix upstream service error represented as 400 #1570
Conversation
@GaryAghedo for these errors:
You should be able to generate the missing headers with |
Hey @Baccata. |
I think it's shaping up well, but there's still a couple things to take care of though. Good work though ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work ! Thank you for this !
@kubukoz, wanna do a review as well ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, let's just make the case class more bincompat-friendly
Issue -#1438
Issue description:
When an upstream service fails with a non-parseable response (e.g., due to an internal server error), the Smithy4s client wraps this failure in an
HttpPayloadError
. Currently, the Smithy4s server interprets thisHttpPayloadError
as a client-side error and responds with a400 BadRequest
. This behaviour incorrectly suggests that the error originated from the client's request, making it difficult to debug actual upstream service failures. The correct behaviour should be for the server to respond with a500 InternalServerError
, indicating an issue with the upstream service rather than the client's request.Solution:
Define a new error type
RawErrorResponse
:Created a new error type
RawErrorResponse
to represent detailed errors, including a failed decode attempt, originating from upstream services.Update
HttpResponse
:Updated
HttpResponse
to handleRawErrorResponse
by including detailed information about the failed decode attempt when appropriate.Test
Added a test case to
PizzaSpec
to validate the server's response when aRawErrorResponse
is raised, ensuring that it returns a 500 status code with detailed information about the failed decode attempt.