Skip to content

Commit 5bada1e

Browse files
authored
Log root cause exceptions in mappers (#2837)
Fix `IcebergExceptionMapper` and `PolarisExceptionMapper` to pass exceptions as "cause" to the logger (as opposed to unreferenced log parameters).
1 parent 84f96c7 commit 5bada1e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

runtime/service/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ public Response toResponse(RuntimeException runtimeException) {
9898
} else {
9999
getLoggerForExceptionLogging()
100100
.atLevel(responseCode > 500 ? Level.INFO : Level.DEBUG)
101-
.log("Full RuntimeException", runtimeException);
101+
.setCause(runtimeException)
102+
.log("Full RuntimeException");
102103
}
103104

104105
ErrorResponse icebergErrorResponse =

runtime/service/src/main/java/org/apache/polaris/service/exception/PolarisExceptionMapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public Response toResponse(PolarisException exception) {
6868
getLogger()
6969
.atLevel(
7070
status.getFamily() == Response.Status.Family.SERVER_ERROR ? Level.INFO : Level.DEBUG)
71-
.log("Full PolarisException", exception);
71+
.setCause(exception)
72+
.log("Full PolarisException");
7273

7374
ErrorResponse errorResponse =
7475
ErrorResponse.builder()

0 commit comments

Comments
 (0)