10000JI opened a new pull request, #8757:
URL: https://github.com/apache/gravitino/pull/8757

   Fixes #8660
   
   ### What changes were proposed in this pull request?
   
   Add `NoSuchCatalogException` handling to the `DeleteTopic` command to 
provide clear error messages when attempting to delete a topic from a 
non-existent catalog. This aligns the exception handling with other Delete 
commands in the CLI module (`DeleteFileset`, `DeleteModel`, `DeleteSchema`, 
etc.).
   
   ### Why are the changes needed?
   
   - The `DeleteTopic.handle()` method was missing explicit handling for 
`NoSuchCatalogException`, which could result in generic error messages instead 
of the user-friendly `ErrorMessages.UNKNOWN_CATALOG` message
   - All other Delete commands (`DeleteFileset`, `DeleteModel`, `DeleteSchema`, 
etc.) consistently handle `NoSuchCatalogException` with the same pattern
   - This change ensures consistent error messaging across all CLI Delete 
commands, improving user experience when errors occur
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, but only for error scenarios. When a user attempts to delete a topic 
from a non-existent catalog, they will now see a clear error message (`"Unknown 
catalog name."`) instead of a generic exception message. Valid operations 
remain unchanged.
   
   ### How was this patch tested?
   
   - Existing unit tests (`testDeleteTopicCommand`, 
`testDeleteTopicForceCommand`) continue to pass, ensuring no functional 
regression
   - Local testing completed successfully with Gradle build and Spotless 
formatting
   - **Note on test coverage:** Following the project's established testing 
pattern, unit tests for Delete commands focus on command routing and invocation 
verification using mocks. Exception handling logic (including 
`NoSuchCatalogException`, `NoSuchMetalakeException`, `NoSuchSchemaException`) 
is consistently not unit-tested across all CLI Delete commands (`DeleteRole`, 
`DeleteModel`, `DeleteFileset`, etc.). This PR maintains that convention. If 
additional test coverage for exception handling is desired, I'm happy to add 
it—please let me know your preference.
   


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