Package net.devh.boot.grpc.server.error
Class GrpcExceptionInterceptor
java.lang.Object
net.devh.boot.grpc.server.error.GrpcExceptionInterceptor
- All Implemented Interfaces:
ServerInterceptor
Interceptor to use for global exception handling. Every raised
Throwable
is caught and being processed.
Actual processing of exception is in GrpcExceptionListener
.
-
Constructor Summary
ConstructorsConstructorDescriptionGrpcExceptionInterceptor
(GrpcExceptionResponseHandler grpcAdviceExceptionHandler) Creates a new GrpcAdviceExceptionInterceptor. -
Method Summary
Modifier and TypeMethodDescription<ReqT,
RespT>
ServerCall.Listener<ReqT>interceptCall
(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) protected <ReqT> ServerCall.Listener<ReqT>
Creates a new no-op call listener because you can neither return null nor throw an exception ininterceptCall(ServerCall, Metadata, ServerCallHandler)
.
-
Constructor Details
-
GrpcExceptionInterceptor
Creates a new GrpcAdviceExceptionInterceptor.- Parameters:
grpcAdviceExceptionHandler
- The exception handler to use.
-
-
Method Details
-
interceptCall
public <ReqT,RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) - Specified by:
interceptCall
in interfaceServerInterceptor
-
noOpCallListener
Creates a new no-op call listener because you can neither return null nor throw an exception ininterceptCall(ServerCall, Metadata, ServerCallHandler)
.- Type Parameters:
ReqT
- The type of the request.- Returns:
- The newly created dummy listener.
-