Beispiel #1
0
 /// <summary>
 /// Returns true if an AggregateException contains a Grpc.Core.RpcException
 /// with the given error code.
 /// </summary>
 /// <param name="e">The exception to examine.</param>
 /// <param name="errorCode">The error code to look for.</param>
 /// <returns></returns>
 static bool ContainsGrpcError(AggregateException e,
                               Grpc.Core.StatusCode errorCode)
 {
     foreach (var innerException in e.InnerExceptions)
     {
         Grpc.Core.RpcException grpcException = innerException
                                                as Grpc.Core.RpcException;
         if (grpcException != null &&
             grpcException.Status.StatusCode == errorCode)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #2
0
 /// <summary>
 /// The constructor.
 /// </summary>
 public GrpcStatusInfo(Grpc.Core.StatusCode statusCode, string message)
 {
     this.GrpcStatusCode   = statusCode;
     this.GrpcErrorMessage = message;
 }
 public void SetStatusCode(ServiceContext context, Grpc.Core.StatusCode statusCode, string detail)
 {
     context.CallContext.Status = new Grpc.Core.Status(statusCode, detail);
 }