Copilot commented on code in PR #10988:
URL: https://github.com/apache/gravitino/pull/10988#discussion_r3212102175


##########
clients/client-java/src/main/java/org/apache/gravitino/client/ErrorHandlers.java:
##########
@@ -424,6 +435,61 @@ public void accept(ErrorResponse errorResponse) {
     }
   }
 
+  /** Error handler specific to View operations. */
+  @SuppressWarnings("FormatStringAnnotation")
+  private static class ViewErrorHandler extends RestErrorHandler {
+    private static final ErrorHandler INSTANCE = new ViewErrorHandler();
+
+    @Override
+    public void accept(ErrorResponse errorResponse) {
+      String errorMessage = formatErrorMessage(errorResponse);
+
+      switch (errorResponse.getCode()) {
+        case ErrorConstants.ILLEGAL_ARGUMENTS_CODE:
+          throw new IllegalArgumentException(errorMessage);
+
+        case ErrorConstants.NOT_FOUND_CODE:
+          if 
(errorResponse.getType().equals(NoSuchSchemaException.class.getSimpleName())) {
+            throw new NoSuchSchemaException(errorMessage);
+          } else if 
(errorResponse.getType().equals(NoSuchCatalogException.class.getSimpleName())) {
+            throw new NoSuchCatalogException(errorMessage);

Review Comment:
   ViewErrorHandler does not translate NOT_FOUND responses with type 
NoSuchMetalakeException into the corresponding client exception, so callers 
will see a generic NotFoundException instead. Since view endpoints are scoped 
under a metalake, consider adding an explicit branch to throw 
NoSuchMetalakeException (similar to CatalogErrorHandler) to keep error handling 
consistent and more specific.
   



-- 
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]

Reply via email to