You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/09/21 16:20:30 UTC
[GitHub] [iceberg] bryanck commented on a diff in pull request #5820: REST: implement handling of OAuth error responses followup
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org