justinmclean opened a new issue, #10175:
URL: https://github.com/apache/gravitino/issues/10175
### What would you like to be improved?
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.
### How should we improve?
Pass the actual partition path parameter to the exception handler in the GET
catch block:
handlePartitionException(OperationType.GET, partition, table, e).
Here's a unit test to help:
```
@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]"));
}
```
--
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]