jerqi commented on code in PR #7828:
URL: https://github.com/apache/gravitino/pull/7828#discussion_r2287382018
##########
clients/client-java/src/main/java/org/apache/gravitino/client/ErrorHandlers.java:
##########
@@ -1190,6 +1201,74 @@ public void accept(ErrorResponse errorResponse) {
}
}
+ /** Error handler specific to Statistics operations. */
+ @SuppressWarnings("FormatStringAnnotation")
+ private static class StatisticsErrorHandler extends RestErrorHandler {
+
+ private static final StatisticsErrorHandler INSTANCE = new
StatisticsErrorHandler();
+
+ @Override
+ public void accept(ErrorResponse errorResponse) {
+ String errorMessage = formatErrorMessage(errorResponse);
+
+ switch (errorResponse.getCode()) {
+ case ErrorConstants.ILLEGAL_ARGUMENTS_CODE:
+ if
(errorResponse.getType().equals(IllegalStatisticNameException.class.getSimpleName()))
{
+ throw new IllegalStatisticNameException(errorMessage);
+ } else {
+ throw new IllegalArgumentException(errorMessage);
+ }
+
+ case ErrorConstants.NOT_FOUND_CODE:
+ if
(errorResponse.getType().equals(NoSuchCatalogException.class.getSimpleName())) {
Review Comment:
Use switch.
--
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]