Exemplo n.º 1
0
 public override TResponse BlockingUnaryCall <TRequest, TResponse>(TRequest request, ClientInterceptorContext <TRequest, TResponse> context, BlockingUnaryCallContinuation <TRequest, TResponse> continuation)
 {
     try
     {
         return(continuation(request, context));
     }
     catch (Exception caugth)
     {
         var(converted, ok) = ExceptionConverter.Convert(caugth);
         if (!ok)
         {
             throw;
         }
         throw converted;
     }
 }
Exemplo n.º 2
0
        public override AsyncClientStreamingCall <TRequest, TResponse> AsyncClientStreamingCall <TRequest, TResponse>(ClientInterceptorContext <TRequest, TResponse> context, AsyncClientStreamingCallContinuation <TRequest, TResponse> continuation)
        {
            var responseCnt   = continuation(context);
            var responseAsync = responseCnt.ResponseAsync.ContinueWith(responseTask =>
            {
                try
                {
                    return(responseTask.Result);
                }
                catch (Exception caugth)
                {
                    var(converted, ok) = ExceptionConverter.Convert(caugth);
                    if (!ok)
                    {
                        throw;
                    }
                    throw converted;
                }
            });


            return(new AsyncClientStreamingCall <TRequest, TResponse>(responseCnt.RequestStream, responseAsync, responseCnt.ResponseHeadersAsync, responseCnt.GetStatus, responseCnt.GetTrailers, responseCnt.Dispose));
        }