Table of Contents

Class ErrorInfoInterceptor

Namespace
Virtufin.Api.Services
Assembly
Virtufin.Api.dll

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

logger ILogger<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

request TRequest

The request value of the incoming invocation.

responseStream IServerStreamWriter<TResponse>

The response stream of the incoming invocation.

context ServerCallContext

An instance of ServerCallContext representing the context of the invocation.

continuation ServerStreamingServerMethod<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

Task

Type Parameters

TRequest

Request message type for this method.

TResponse

Response 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

request TRequest

The request value of the incoming invocation.

context ServerCallContext

An instance of ServerCallContext representing the context of the invocation.

continuation UnaryServerMethod<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

TRequest

Request message type for this method.

TResponse

Response message type for this method.