bryanck commented on code in PR #5820:
URL: https://github.com/apache/iceberg/pull/5820#discussion_r976730672
##########
core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java:
##########
@@ -100,15 +123,30 @@ private static Consumer<ErrorResponse>
baseNamespaceErrorHandler() {
case 422:
throw new RESTException("Unable to process: %s", error.message());
}
- };
+
+ super.accept(error);
+ }
}
/**
* Request error handler that handles the common cases that are included
with all responses, such
* as 400, 500, etc.
*/
- public static Consumer<ErrorResponse> defaultErrorHandler() {
- return error -> {
+ private static class DefaultErrorHandler extends ErrorHandler {
+ private static final ErrorHandler INSTANCE = new DefaultErrorHandler();
+
+ @Override
+ public ErrorResponse parseResponse(int code, String json) {
+ try {
+ return ErrorResponseParser.fromJson(json);
+ } catch (Exception x) {
+ LOG.warn("Unable to parse error response", x);
Review Comment:
This method creates an ErrorResponse even if it can't be parsed. Before an
exception would be thrown, and the original error would be lost.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]