Example #1
0
        public override Task <PingResponse> UnaryPing(PingRequest request, ServerCallContext context)
        {
            if (request.Status == Status.Ok)
            {
                return(Task.FromResult(new PingResponse()
                {
                    Message = "OK"
                }));
            }

            global::Grpc.Core.Status status = new global::Grpc.Core.Status(StatusCode.Internal, "details");
            throw new RpcException(status);
        }
Example #2
0
        public override async Task <PingResponse> UnaryPing(PingRequest request, ServerCallContext context)
        {
            if (request.Status == Status.Ok)
            {
                PingResponse response = null;

                await Task.Run(() => response = new PingResponse()
                {
                    Message = "OK"
                });

                return(response);
            }

            global::Grpc.Core.Status status = new global::Grpc.Core.Status(StatusCode.Internal, "details");
            throw new RpcException(status);
        }
Example #3
0
 private void ThrowException()
 {
     global::Grpc.Core.Status status = new global::Grpc.Core.Status(StatusCode.Internal, "details");
     throw new RpcException(status);
 }