Skip to content

Commit

Permalink
refactor: rename class and log error
Browse files Browse the repository at this point in the history
  • Loading branch information
Zelldon committed Sep 18, 2023
1 parent 7aee8be commit eb68c81
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BadRequestResponseFilter implements ClientResponseFilter {
public class BadResponseFilter implements ClientResponseFilter {

private static final Logger LOG = LoggerFactory.getLogger(BadResponseFilter.class);

@Override
public void filter(
Expand All @@ -20,14 +24,17 @@ public void filter(
final String responseBody =
IOUtils.toString(responseContext.getEntityStream(), StandardCharsets.UTF_8);

throw new IOException(
final String errorMessage =
responseContext.getStatusInfo().toEnum()
+ " returned from URI: "
+ requestContext.getUri()
+ ", requestBody:"
+ requestBody
+ ", responseBody: "
+ responseBody);
+ responseBody;

LOG.error(errorMessage);
throw new IOException(errorMessage);
}
}
}

0 comments on commit eb68c81

Please sign in to comment.