Skip to content

Commit

Permalink
fix: log more response errors
Browse files Browse the repository at this point in the history
Previously we only logged (not sure but current assumption) BAD_REQUEST returned from saas
  • Loading branch information
Zelldon committed Sep 18, 2023
1 parent 2cac4a7 commit 7aee8be
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ public class BadRequestResponseFilter implements ClientResponseFilter {
public void filter(
final ClientRequestContext requestContext, final ClientResponseContext responseContext)
throws IOException {
if (responseContext.getStatus() > 399) {

if (responseContext.getStatus() == 400) {
final String requestBody = new ObjectMapper().writeValueAsString(requestContext.getEntity());
final String responseBody =
IOUtils.toString(responseContext.getEntityStream(), StandardCharsets.UTF_8);

throw new IOException(
"BAD REQUEST returned from URI: "
responseContext.getStatusInfo().toEnum()
+ " returned from URI: "
+ requestContext.getUri()
+ ", requestBody:"
+ requestBody
Expand Down

0 comments on commit 7aee8be

Please sign in to comment.