You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2025/07/01 06:43:43 UTC

(paimon) branch master updated: [hotfix] add detail information for NoPermissionException (#5821)

This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new ffff4e0f62 [hotfix] add detail information for NoPermissionException (#5821)
ffff4e0f62 is described below

commit ffff4e0f627ad7abddb26c68e182fe5a6dde5f31
Author: kevin <38...@users.noreply.github.com>
AuthorDate: Tue Jul 1 14:43:38 2025 +0800

    [hotfix] add detail information for NoPermissionException (#5821)
---
 .../main/java/org/apache/paimon/catalog/Catalog.java   | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java b/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java
index 6eda935c26..3de3d50769 100644
--- a/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java
+++ b/paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java
@@ -1029,12 +1029,17 @@ public interface Catalog extends AutoCloseable {
 
     /** Exception for trying to operate on the database that doesn't have permission. */
     class DatabaseNoPermissionException extends RuntimeException {
-        private static final String MSG = "Database %s has no permission.";
+        private static final String MSG = "Database %s has no permission. Cause by %s.";
 
         private final String database;
 
         public DatabaseNoPermissionException(String database, Throwable cause) {
-            super(String.format(MSG, database), cause);
+            super(
+                    String.format(
+                            MSG,
+                            database,
+                            cause != null && cause.getMessage() != null ? cause.getMessage() : ""),
+                    cause);
             this.database = database;
         }
 
@@ -1093,12 +1098,17 @@ public interface Catalog extends AutoCloseable {
     /** Exception for trying to operate on the table that doesn't have permission. */
     class TableNoPermissionException extends RuntimeException {
 
-        private static final String MSG = "Table %s has no permission.";
+        private static final String MSG = "Table %s has no permission. Cause by %s.";
 
         private final Identifier identifier;
 
         public TableNoPermissionException(Identifier identifier, Throwable cause) {
-            super(String.format(MSG, identifier.getFullName()), cause);
+            super(
+                    String.format(
+                            MSG,
+                            identifier.getFullName(),
+                            cause != null && cause.getMessage() != null ? cause.getMessage() : ""),
+                    cause);
             this.identifier = identifier;
         }