diqiu50 commented on code in PR #14663:
URL: https://github.com/apache/gravitino/pull/14663#discussion_r4488327444


##########
trino-connector/src/common/main/java/org/apache/gravitino/trino/connector/catalog/CatalogConnectorMetadata.java:
##########
@@ -312,8 +312,11 @@ public void dropSchema(String schemaName, boolean cascade) 
{
     try {
       success = schemaCatalog.dropSchema(schemaName, cascade);
     } catch (NonEmptySchemaException e) {
-      throw new TrinoException(
-          GravitinoErrorCode.GRAVITINO_SCHEMA_NOT_EMPTY, "Schema does not 
empty", e);
+      // Keep the server's reason (for example a blocking dependency on a 
cascade drop) instead of a
+      // fixed text, so the user sees why the drop was refused.
+      String reason =
+          Strings.isNullOrEmpty(e.getMessage()) ? "Schema is not empty" : 
e.getMessage();

Review Comment:
   `e.getMessage()` includes the server stack trace for REST failures, so Trino 
users would see it, even on non-cascade drops. Please route this through 
`GravitinoErrorCode.toTrinoException` so it uses `firstLineMessage`, and cover 
it with a multi-line message in the test.
   
   Also, please check that the first line still names the blocker on 
PostgreSQL, as it may be in a later `Detail:` line.



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