Class ErrorInfoInterceptor
Every failure of the gateway's own services carries a google.rpc.ErrorInfo
(openspec write-results, Failures Are gRPC Statuses With Details). A handler that names
its failure precisely throws Failure(StatusCode, string, string, string?, string?, params IMessage[]); this interceptor gives every
other RpcException the reason its status code implies
(ForStatus(StatusCode)), and turns an unexpected exception into
INTERNAL (Internal) with Virtufin.Api.Services.SafeError.InternalError,
logged here, so no internal detail crosses the boundary and no path answers without
details. Registered first, so the authentication interceptor's refusals get one too.
public sealed class ErrorInfoInterceptor : Interceptor
- Inheritance
-
ErrorInfoInterceptor
- Inherited Members
Constructors
ErrorInfoInterceptor(ILogger<ErrorInfoInterceptor>)
Every failure of the gateway's own services carries a google.rpc.ErrorInfo
(openspec write-results, Failures Are gRPC Statuses With Details). A handler that names
its failure precisely throws Failure(StatusCode, string, string, string?, string?, params IMessage[]); this interceptor gives every
other RpcException the reason its status code implies
(ForStatus(StatusCode)), and turns an unexpected exception into
INTERNAL (Internal) with Virtufin.Api.Services.SafeError.InternalError,
logged here, so no internal detail crosses the boundary and no path answers without
details. Registered first, so the authentication interceptor's refusals get one too.
public ErrorInfoInterceptor(ILogger<ErrorInfoInterceptor> logger)
Parameters
loggerILogger<ErrorInfoInterceptor>
Methods
ServerStreamingServerHandler<TRequest, TResponse>(TRequest, IServerStreamWriter<TResponse>, ServerCallContext, ServerStreamingServerMethod<TRequest, TResponse>)
Server-side handler for intercepting server streaming call.
public override Task ServerStreamingServerHandler<TRequest, TResponse>(TRequest request, IServerStreamWriter<TResponse> responseStream, ServerCallContext context, ServerStreamingServerMethod<TRequest, TResponse> continuation) where TRequest : class where TResponse : class
Parameters
requestTRequestThe request value of the incoming invocation.
responseStreamIServerStreamWriter<TResponse>The response stream of the incoming invocation.
contextServerCallContextAn instance of ServerCallContext representing the context of the invocation.
continuationServerStreamingServerMethod<TRequest, TResponse>A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and the interceptor can choose to call it zero or more times at its discretion. The interceptor has the ability to wrap or substitute the request value and the response stream when calling the continuation.
Returns
Type Parameters
TRequestRequest message type for this method.
TResponseResponse message type for this method.
UnaryServerHandler<TRequest, TResponse>(TRequest, ServerCallContext, UnaryServerMethod<TRequest, TResponse>)
Server-side handler for intercepting an incoming unary call.
public override Task<TResponse> UnaryServerHandler<TRequest, TResponse>(TRequest request, ServerCallContext context, UnaryServerMethod<TRequest, TResponse> continuation) where TRequest : class where TResponse : class
Parameters
requestTRequestThe request value of the incoming invocation.
contextServerCallContextAn instance of ServerCallContext representing the context of the invocation.
continuationUnaryServerMethod<TRequest, TResponse>A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and return the response value of the RPC. The interceptor can choose to call it zero or more times at its discretion.
Returns
- Task<TResponse>
A future representing the response value of the RPC. The interceptor can simply return the return value from the continuation intact, or an arbitrary response value as it sees fit.
Type Parameters
TRequestRequest message type for this method.
TResponseResponse message type for this method.