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

github-bot pushed a commit to branch cherry-pick-5a3c5953-to-branch-1.1
in repository https://gitbox.apache.org/repos/asf/gravitino.git

commit 7b22fab7461014a2743cb8f8ed421002d2741be0
Author: Sambhavi Pandey <[email protected]>
AuthorDate: Fri Mar 20 13:28:10 2026 +0530

    [#10175]improvement(PartitionOperations): include partition path parameter 
in getPartition error handling (#10388)
    
    ### What changes were proposed in this pull request?
    
    Passed the actual partition path parameter to the exception handler in
    the PartitionOperations#getPartition
    
    
    ### Why are the changes needed?
    PartitionOperations#getPartition catches exceptions and calls
    ExceptionHandlers.handlePartitionException(OperationType.GET, "", table,
    e). Passing an empty partition string drops the requested partition
    identifier from the generated error message/context.
    
    
    Fix: #10175
    
    ### Does this PR introduce _any_ user-facing change?
    no
    
    
    ### How was this patch tested?
    unit test
---
 .../server/web/rest/PartitionOperations.java          |  2 +-
 .../server/web/rest/TestPartitionOperations.java      | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/gravitino/server/web/rest/PartitionOperations.java
 
b/server/src/main/java/org/apache/gravitino/server/web/rest/PartitionOperations.java
index 654f401e33..d817e3e48d 100644
--- 
a/server/src/main/java/org/apache/gravitino/server/web/rest/PartitionOperations.java
+++ 
b/server/src/main/java/org/apache/gravitino/server/web/rest/PartitionOperations.java
@@ -162,7 +162,7 @@ public class PartitionOperations {
             return response;
           });
     } catch (Exception e) {
-      return ExceptionHandlers.handlePartitionException(OperationType.GET, "", 
table, e);
+      return ExceptionHandlers.handlePartitionException(OperationType.GET, 
partition, table, e);
     }
   }
 
diff --git 
a/server/src/test/java/org/apache/gravitino/server/web/rest/TestPartitionOperations.java
 
b/server/src/test/java/org/apache/gravitino/server/web/rest/TestPartitionOperations.java
index ea3dd7ec61..2c27c9c7db 100644
--- 
a/server/src/test/java/org/apache/gravitino/server/web/rest/TestPartitionOperations.java
+++ 
b/server/src/test/java/org/apache/gravitino/server/web/rest/TestPartitionOperations.java
@@ -249,6 +249,25 @@ public class TestPartitionOperations extends JerseyTest {
     Assertions.assertTrue(errorResp2.getMessage().contains("p3"));
   }
 
+  @Test
+  public void testGetPartitionExceptionMessageContainsPartitionName() {
+    doThrow(new NoSuchPartitionException("missing partition"))
+        .when(dispatcher)
+        .getPartition(any(), any());
+
+    Response resp =
+        target(partitionPath(metalake, catalog, schema, table) + "p3")
+            .request(MediaType.APPLICATION_JSON_TYPE)
+            .accept("application/vnd.gravitino.v1+json")
+            .get();
+
+    Assertions.assertEquals(Response.Status.NOT_FOUND.getStatusCode(), 
resp.getStatus());
+
+    ErrorResponse errorResponse = resp.readEntity(ErrorResponse.class);
+    Assertions.assertEquals(ErrorConstants.NOT_FOUND_CODE, 
errorResponse.getCode());
+    Assertions.assertTrue(errorResponse.getMessage().contains("[p3]"));
+  }
+
   @Test
   public void testAddPartition() {
     when(dispatcher.addPartition(any(), any())).thenReturn(partition1);

Reply via email to