diqiu50 commented on code in PR #13787:
URL: https://github.com/apache/gravitino/pull/13787#discussion_r4248489176
##########
trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/CatalogConnectorMetadata.java:
##########
@@ -451,6 +483,23 @@ public Function getFunction(String schemaName, String
functionName) {
if (!supportsFunctions()) {
throw new UnsupportedOperationException("Catalog does not support
functions");
}
- return functionCatalog.getFunction(NameIdentifier.of(schemaName,
functionName));
+ try {
+ return functionCatalog.getFunction(NameIdentifier.of(schemaName,
functionName));
+ } catch (ForbiddenException | IllegalArgumentException e) {
+ throw toTrinoException(e);
+ }
+ }
+
+ /**
+ * Converts a refusal reported by the Gravitino server into a Trino
exception that classifies it
+ * as a user-facing error instead of an internal one.
+ */
+ private static TrinoException toTrinoException(RuntimeException e) {
+ String message = GravitinoErrorCode.toSimpleErrorMessage(e);
+ if (e instanceof ForbiddenException) {
+ return new TrinoException(PERMISSION_DENIED, message, e);
Review Comment:
Out of scope for this PR
--
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]