justinmclean commented on code in PR #6573:
URL: https://github.com/apache/gravitino/pull/6573#discussion_r1976528306


##########
clients/cli/src/main/java/org/apache/gravitino/cli/commands/ListTopicProperties.java:
##########
@@ -65,16 +65,28 @@ public void handle() {
     try {
       GravitinoClient client = buildClient(metalake);
       gTopic = client.loadCatalog(catalog).asTopicCatalog().loadTopic(name);
+
+      // Ensure topic exists before accessing properties
+      if (gTopic == null) {
+        exitWithError(ErrorMessages.UNKNOWN_TOPIC);
+        return;
+      }
+
     } catch (NoSuchMetalakeException err) {
       exitWithError(ErrorMessages.UNKNOWN_METALAKE);
+      return;
     } catch (NoSuchCatalogException err) {
       exitWithError(ErrorMessages.UNKNOWN_CATALOG);
+      return;
     } catch (NoSuchSchemaException err) {
       exitWithError(ErrorMessages.UNKNOWN_SCHEMA);
+      return;
     } catch (NoSuchTopicException err) {
       exitWithError(ErrorMessages.UNKNOWN_TOPIC);
+      return;
     } catch (Exception exp) {
-      exitWithError(exp.getMessage());
+      exitWithError("An unexpected error occurred: " + exp.getMessage());

Review Comment:
   please don't change this



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