justinmclean commented on code in PR #6573: URL: https://github.com/apache/gravitino/pull/6573#discussion_r1976573787
########## clients/cli/src/main/java/org/apache/gravitino/cli/commands/UserDetails.java: ########## @@ -47,23 +47,21 @@ public UserDetails(CommandContext context, String metalake, String user) { /** Displays the roles of a specified user. */ @Override public void handle() { - List<String> roles = null; + try (GravitinoClient client = buildClient(metalake)) { + List<String> roles = client.getUser(user).roles(); - try { - GravitinoClient client = buildClient(metalake); - roles = client.getUser(user).roles(); - } catch (NoSuchMetalakeException err) { + if (roles == null || roles.isEmpty()) { + printInformation("The user has no assigned roles."); + } else { + printResults("User Roles: " + String.join(", ", roles)); + } Review Comment: please move to outside the try block -- 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: commits-unsubscr...@gravitino.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org