using Grpc.Core; using Grpc.Core.Interceptors; using Microsoft.Extensions.Logging; namespace BuildingBlocks.Exception; public class GrpcExceptionInterceptor : Interceptor { public override async Task UnaryServerHandler( TRequest request, ServerCallContext context, UnaryServerMethod continuation) { try { return await continuation(request, context); } catch (System.Exception exception) { throw new RpcException(new Status(StatusCode.Internal, exception.Message)); } } }