Error reason not propagating on some status codes #753
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.
Description
When executing a server requests, we have 2 possible errors:
For the first one, we convert the exception into a
ResponseMessage
with theErrorMessage
property coming from the exception.The second kind gets treated as a normal response and passed forward, but the actual reason for the error is within the
ResponseBody
.This PR fixes this scenario by making sure that, when
EnsureSuccessStatusCode
is called on aResponseMessage
, we generate theErrorMessage
based on the body if it wasn't already set. So for the cases where the errors are coming from exceptions, this is a no-op, but for the cases of errors coming as responses, we materialize the body and obtain the error.Additionally, as part of the investigation, a bug was found in the
GatewayStoreClient
that was not propagating the body in the case of such status codes.Type of change
Closing issues
Closes #681