Skip to content

Commit b3eb9c2

Browse files
therepanicdsyer
authored andcommitted
add error logging in FallbackHandler for unknown exceptions
Closes: gh-227 Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
1 parent 1579597 commit b3eb9c2

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

spring-grpc-core/src/main/java/org/springframework/grpc/server/exception/GrpcExceptionHandlerInterceptor.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package org.springframework.grpc.server.exception;
1717

18+
import org.apache.commons.logging.Log;
19+
import org.apache.commons.logging.LogFactory;
20+
1821
import org.springframework.core.Ordered;
1922
import org.springframework.core.annotation.Order;
2023

@@ -160,14 +163,22 @@ static class FallbackHandler implements GrpcExceptionHandler {
160163

161164
private final GrpcExceptionHandler exceptionHandler;
162165

166+
private static final Log logger = LogFactory.getLog(FallbackHandler.class);
167+
163168
FallbackHandler(GrpcExceptionHandler exceptionHandler) {
164169
this.exceptionHandler = exceptionHandler;
165170
}
166171

167172
@Override
168173
public StatusException handleException(Throwable exception) {
169174
StatusException status = this.exceptionHandler.handleException(exception);
170-
return status != null ? status : Status.fromThrowable(exception).asException();
175+
if (status == null) {
176+
if (logger.isDebugEnabled()) {
177+
logger.error("Unknown exception", exception);
178+
}
179+
return Status.fromThrowable(exception).asException();
180+
}
181+
return status;
171182
}
172183

173184
}

0 commit comments

Comments
 (0)