From f859fc80e5089ad29c4ee6929b4dbdfcb923ffb2 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Mon, 31 Jan 2022 18:11:42 +0300 Subject: [PATCH] Delete GrpcExceptionInterceptor.cs --- .../Grpc/GrpcExceptionInterceptor.cs | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 services/basket/src/EShopOnAbp.BasketService.Application/Grpc/GrpcExceptionInterceptor.cs diff --git a/services/basket/src/EShopOnAbp.BasketService.Application/Grpc/GrpcExceptionInterceptor.cs b/services/basket/src/EShopOnAbp.BasketService.Application/Grpc/GrpcExceptionInterceptor.cs deleted file mode 100644 index 5c746202..00000000 --- a/services/basket/src/EShopOnAbp.BasketService.Application/Grpc/GrpcExceptionInterceptor.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Threading.Tasks; -using Grpc.Core; -using Grpc.Core.Interceptors; -using Microsoft.Extensions.Logging; -using Volo.Abp.DependencyInjection; - -namespace EShopOnAbp.BasketService.Grpc; - -public class GrpcExceptionInterceptor : Interceptor, ITransientDependency -{ - private readonly ILogger _logger; - - public GrpcExceptionInterceptor(ILogger logger) - { - _logger = logger; - } - - public override AsyncUnaryCall AsyncUnaryCall( - TRequest request, - ClientInterceptorContext context, - AsyncUnaryCallContinuation continuation) - { - var call = continuation(request, context); - - return new AsyncUnaryCall(HandleResponse(call.ResponseAsync), call.ResponseHeadersAsync, - call.GetStatus, call.GetTrailers, call.Dispose); - } - - private async Task HandleResponse(Task task) - { - try - { - var response = await task; - return response; - } - catch (RpcException e) - { - _logger.LogError("Error calling via grpc: {Status} - {Message}", e.Status, e.Message); - return default; - } - } -} \ No newline at end of file