justinmclean commented on code in PR #6573:
URL: https://github.com/apache/gravitino/pull/6573#discussion_r1976526544
##########
clients/cli/src/main/java/org/apache/gravitino/cli/commands/CatalogAudit.java:
##########
@@ -53,12 +53,20 @@ public void handle() {
result = client.loadCatalog(this.catalog);
} catch (NoSuchMetalakeException err) {
exitWithError(ErrorMessages.UNKNOWN_METALAKE);
+ return; // Stop execution after handling error
} catch (NoSuchCatalogException err) {
exitWithError(ErrorMessages.UNKNOWN_CATALOG);
+ return; // Stop execution after handling error
} catch (Exception exp) {
exitWithError(exp.getMessage());
+ return; // Stop execution after handling error
}
- displayAuditInfo(result.auditInfo());
+ // **Null check before accessing auditInfo()**
+ if (result != null && result.auditInfo() != null) {
+ displayAuditInfo(result.auditInfo());
+ } else {
+ exitWithError("Audit information is not available for this catalog.");
+ }
Review Comment:
This is no need for an exitWithError here, having no output is fine and not
an error.
--
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]