private void Fail( TProtocol oprot, TMessage message, TApplicationException.ExceptionType extype, string etxt)
        {
            TApplicationException appex = new TApplicationException( extype, etxt);

            TMessage newMessage = new TMessage(message.Name, TMessageType.Exception, message.SeqID);

            oprot.WriteMessageBegin(newMessage);
            appex.Write( oprot);
            oprot.WriteMessageEnd();
            oprot.Transport.Flush();
        }
예제 #2
0
        public List <PositionViewEntity> recv_getAllPositionInfo()
        {
            TMessage msg = iprot_.ReadMessageBegin();

            if (msg.Type == TMessageType.Exception)
            {
                TApplicationException x = TApplicationException.Read(iprot_);
                iprot_.ReadMessageEnd();
                throw x;
            }
            getAllPositionInfo_result result = new getAllPositionInfo_result();

            result.Read(iprot_);
            iprot_.ReadMessageEnd();
            if (result.__isset.success)
            {
                return(result.Success);
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "getAllPositionInfo failed: unknown result");
        }
예제 #3
0
        public static TApplicationException CreateAndWriteApplicationException(TProtocol outProtocol,
                                                                               IRequestContext requestContext,
                                                                               string methodName,
                                                                               int sequenceId,
                                                                               TApplicationException.ExceptionType exceptionType,
                                                                               string message,
                                                                               AggregateException cause,
                                                                               ILogger logger)
        {
            // unexpected exception
            String error = message;

            if (cause != null)
            {
                error = String.Concat(error, $"{Environment.NewLine}{cause.ToString()}");
            }
            TApplicationException applicationException = new TApplicationException(exceptionType, error);

            return(WriteApplicationException(outProtocol, requestContext, methodName, sequenceId, applicationException, logger));
        }
예제 #4
0
        public int recv_Add()
        {
            TMessage msg = iprot_.ReadMessageBegin();

            if (msg.Type == TMessageType.Exception)
            {
                TApplicationException x = TApplicationException.Read(iprot_);
                iprot_.ReadMessageEnd();
                throw x;
            }
            Add_result result = new Add_result();

            result.Read(iprot_);
            iprot_.ReadMessageEnd();
            if (result.__isset.success)
            {
                return(result.Success);
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "Add failed: unknown result");
        }
예제 #5
0
            public List <Feature> recv_getFeaturesInRect()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                getFeaturesInRect_result result = new getFeaturesInRect_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "getFeaturesInRect failed: unknown result");
            }
        public void recv_notify()
        {
            TMessage msg = iprot_.ReadMessageBegin();

            if (msg.Type == TMessageType.Exception)
            {
                TApplicationException x = TApplicationException.Read(iprot_);
                iprot_.ReadMessageEnd();
                throw x;
            }
            notify_result result = new notify_result();

            result.Read(iprot_);
            iprot_.ReadMessageEnd();
            if (result.__isset.e)
            {
                throw result.E;
            }
            return;
        }
예제 #7
0
            public List <BookInfo> recv_GetAllBooks()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                GetAllBooks_result result = new GetAllBooks_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "GetAllBooks failed: unknown result");
            }
예제 #8
0
            public Ruyi.SDK.Speech.SpeechResult recv_Say()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                Say_result result = new Say_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "Say failed: unknown result");
            }
예제 #9
0
파일: Scribe.cs 프로젝트: ysj123688/Thrifty
            public List <LogEntry> recv_getMessages()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                getMessages_result result = new getMessages_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.Success != null)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "getMessages failed: unknown result");
            }
예제 #10
0
            public void recv_addUser()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                addUser_result result = new addUser_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.err)
                {
                    throw result.Err;
                }
                return;
            }
예제 #11
0
파일: Scribe.cs 프로젝트: ysj123688/Thrifty
            public ResultCode recv_Log()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                Log_result result = new Log_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.Success.HasValue)
                {
                    return(result.Success.Value);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "Log failed: unknown result");
            }
예제 #12
0
            public Status recv_appendBatch()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                appendBatch_result result = new appendBatch_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "appendBatch failed: unknown result");
            }
예제 #13
0
            public sbyte recv_OfflineQues()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                OfflineQues_result result = new OfflineQues_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "OfflineQues failed: unknown result");
            }
예제 #14
0
        public string recv_getLocationInfoIncremental()
        {
            TMessage msg = iprot_.ReadMessageBegin();

            if (msg.Type == TMessageType.Exception)
            {
                TApplicationException x = TApplicationException.Read(iprot_);
                iprot_.ReadMessageEnd();
                throw x;
            }
            getLocationInfoIncremental_result result = new getLocationInfoIncremental_result();

            result.Read(iprot_);
            iprot_.ReadMessageEnd();
            if (result.__isset.success)
            {
                return(result.Success);
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "getLocationInfoIncremental failed: unknown result");
        }
예제 #15
0
            public MMIStandard.MAvatarPostureValues recv_Blend()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                Blend_result result = new Blend_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "Blend failed: unknown result");
            }
예제 #16
0
            public List <Question> recv_QueryQuestions()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                QueryQuestions_result result = new QueryQuestions_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "QueryQuestions failed: unknown result");
            }
예제 #17
0
            public MMIStandard.MBoolResponse recv_SetBlendingMask()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                SetBlendingMask_result result = new SetBlendingMask_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "SetBlendingMask failed: unknown result");
            }
예제 #18
0
        public TicketStatusDTO recv_cancelTicketExecution()
        {
            TMessage msg = iprot_.ReadMessageBegin();

            if (msg.Type == TMessageType.Exception)
            {
                TApplicationException x = TApplicationException.Read(iprot_);
                iprot_.ReadMessageEnd();
                throw x;
            }
            cancelTicketExecution_result result = new cancelTicketExecution_result();

            result.Read(iprot_);
            iprot_.ReadMessageEnd();
            if (result.__isset.success)
            {
                return(result.Success);
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "cancelTicketExecution failed: unknown result");
        }
예제 #19
0
            public SendResponse_0 recv_sendSync_0()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                sendSync_0_result result = new sendSync_0_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "sendSync_0 failed: unknown result");
            }
예제 #20
0
            public bool recv_deleteFeature()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                deleteFeature_result result = new deleteFeature_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "deleteFeature failed: unknown result");
            }
예제 #21
0
        public List <string> recv_testCase2()
        {
            TMessage msg = iprot_.ReadMessageBegin();

            if (msg.Type == TMessageType.Exception)
            {
                TApplicationException x = TApplicationException.Read(iprot_);
                iprot_.ReadMessageEnd();
                throw x;
            }
            testCase2_result result = new testCase2_result();

            result.Read(iprot_);
            iprot_.ReadMessageEnd();
            if (result.__isset.success)
            {
                return(result.Success);
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "testCase2 failed: unknown result");
        }
예제 #22
0
            public AuthResponse recv_authenticate()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                authenticate_result result = new authenticate_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "authenticate failed: unknown result");
            }
        public string recv_GetRecipeData()
        {
            TMessage msg = iprot_.ReadMessageBegin();

            if (msg.Type == TMessageType.Exception)
            {
                TApplicationException x = TApplicationException.Read(iprot_);
                iprot_.ReadMessageEnd();
                throw x;
            }
            GetRecipeData_result result = new GetRecipeData_result();

            result.Read(iprot_);
            iprot_.ReadMessageEnd();
            if (result.__isset.success)
            {
                return(result.Success);
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "GetRecipeData failed: unknown result");
        }
예제 #24
0
        public Dictionary <int, Customer> recv_GetMap()
        {
            TMessage msg = iprot_.ReadMessageBegin();

            if (msg.Type == TMessageType.Exception)
            {
                TApplicationException x = TApplicationException.Read(iprot_);
                iprot_.ReadMessageEnd();
                throw x;
            }
            GetMap_result result = new GetMap_result();

            result.Read(iprot_);
            iprot_.ReadMessageEnd();
            if (result.__isset.success)
            {
                return(result.Success);
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "GetMap failed: unknown result");
        }
예제 #25
0
            public Ruyi.SDK.StorageLayer.GetLocalPathResult recv_GetLocalPath()
            {
                TMessage msg = iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(iprot_);
                    iprot_.ReadMessageEnd();
                    throw x;
                }
                GetLocalPath_result result = new GetLocalPath_result();

                result.Read(iprot_);
                iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "GetLocalPath failed: unknown result");
            }
예제 #26
0
            public byte[] recv_Revert()
            {
                TMessage msg = this.iprot_.ReadMessageBegin();

                if (msg.Type == TMessageType.Exception)
                {
                    TApplicationException x = TApplicationException.Read(this.iprot_);
                    this.iprot_.ReadMessageEnd();
                    throw x;
                }
                Revert_result result = new Revert_result();

                result.Read(this.iprot_);
                this.iprot_.ReadMessageEnd();
                if (result.__isset.success)
                {
                    return(result.Success);
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "Revert failed: unknown result");
            }
예제 #27
0
        public async Task <SpotPhoneNumberResponse> lookupByPhoneNumberAsync(string countryAreaCode, string phoneNumber, CancellationToken cancellationToken)
        {
            await OutputProtocol.WriteMessageBeginAsync(new TMessage("lookupByPhoneNumber", TMessageType.Call, SeqId), cancellationToken);

            var args = new lookupByPhoneNumberArgs();

            args.CountryAreaCode = countryAreaCode;
            args.PhoneNumber     = phoneNumber;

            await args.WriteAsync(OutputProtocol, cancellationToken);

            await OutputProtocol.WriteMessageEndAsync(cancellationToken);

            await OutputProtocol.Transport.FlushAsync(cancellationToken);

            var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken);

            if (msg.Type == TMessageType.Exception)
            {
                var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken);

                await InputProtocol.ReadMessageEndAsync(cancellationToken);

                throw x;
            }

            var result = new lookupByPhoneNumberResult();
            await result.ReadAsync(InputProtocol, cancellationToken);

            await InputProtocol.ReadMessageEndAsync(cancellationToken);

            if (result.__isset.success)
            {
                return(result.Success);
            }
            if (result.__isset.e)
            {
                throw result.E;
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "lookupByPhoneNumber failed: unknown result");
        }
            public async global::System.Threading.Tasks.Task submitBatches_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
            {
                var args = new InternalStructs.submitBatchesArgs();
                await args.ReadAsync(iprot, cancellationToken);

                await iprot.ReadMessageEndAsync(cancellationToken);

                var result = new InternalStructs.submitBatchesResult();

                try
                {
                    result.Success = await _iAsync.submitBatchesAsync(args.Batches, cancellationToken);

                    await oprot.WriteMessageBeginAsync(new TMessage("submitBatches", TMessageType.Reply, seqid), cancellationToken);

                    await result.WriteAsync(oprot, cancellationToken);
                }
                catch (TTransportException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    var sErr = $"Error occurred in {GetType().FullName}: {ex.Message}";
                    if (_logger != null)
                    {
                        _logger.LogError(ex, sErr);
                    }
                    else
                    {
                        Console.Error.WriteLine(sErr);
                    }
                    var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                    await oprot.WriteMessageBeginAsync(new TMessage("submitBatches", TMessageType.Exception, seqid), cancellationToken);

                    await x.WriteAsync(oprot, cancellationToken);
                }
                await oprot.WriteMessageEndAsync(cancellationToken);

                await oprot.Transport.FlushAsync(cancellationToken);
            }
예제 #29
0
        public async Task <SnsProfile> getSnsMyProfileAsync(SnsIdType snsIdType, string snsAccessToken, CancellationToken cancellationToken)
        {
            await OutputProtocol.WriteMessageBeginAsync(new TMessage("getSnsMyProfile", TMessageType.Call, SeqId), cancellationToken);

            var args = new getSnsMyProfileArgs();

            args.SnsIdType      = snsIdType;
            args.SnsAccessToken = snsAccessToken;

            await args.WriteAsync(OutputProtocol, cancellationToken);

            await OutputProtocol.WriteMessageEndAsync(cancellationToken);

            await OutputProtocol.Transport.FlushAsync(cancellationToken);

            var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken);

            if (msg.Type == TMessageType.Exception)
            {
                var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken);

                await InputProtocol.ReadMessageEndAsync(cancellationToken);

                throw x;
            }

            var result = new getSnsMyProfileResult();
            await result.ReadAsync(InputProtocol, cancellationToken);

            await InputProtocol.ReadMessageEndAsync(cancellationToken);

            if (result.__isset.success)
            {
                return(result.Success);
            }
            if (result.__isset.e)
            {
                throw result.E;
            }
            throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "getSnsMyProfile failed: unknown result");
        }
예제 #30
0
            public async Task <int> calculateAsync(int logid, Work w, CancellationToken cancellationToken)
            {
                await OutputProtocol.WriteMessageBeginAsync(new TMessage("calculate", TMessageType.Call, SeqId), cancellationToken);

                var args = new calculateArgs();

                args.Logid = logid;
                args.W     = w;

                await args.WriteAsync(OutputProtocol, cancellationToken);

                await OutputProtocol.WriteMessageEndAsync(cancellationToken);

                await OutputProtocol.Transport.FlushAsync(cancellationToken);

                var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken);

                if (msg.Type == TMessageType.Exception)
                {
                    var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken);

                    await InputProtocol.ReadMessageEndAsync(cancellationToken);

                    throw x;
                }

                var result = new calculateResult();
                await result.ReadAsync(InputProtocol, cancellationToken);

                await InputProtocol.ReadMessageEndAsync(cancellationToken);

                if (result.__isset.success)
                {
                    return(result.Success);
                }
                if (result.__isset.ouch)
                {
                    throw result.Ouch;
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "calculate failed: unknown result");
            }
예제 #31
0
            public async global::System.Threading.Tasks.Task <global::APIGateway.Thrift.Generated.NotificationTypes.NotificationQueueResponse> SendNotificationAsync(global::APIGateway.Thrift.Generated.NotificationTypes.NotificationQueueRequest queueRequest, CancellationToken cancellationToken = default)
            {
                await OutputProtocol.WriteMessageBeginAsync(new TMessage("SendNotification", TMessageType.Call, SeqId), cancellationToken);

                var args = new InternalStructs.SendNotificationArgs()
                {
                    QueueRequest = queueRequest,
                };

                await args.WriteAsync(OutputProtocol, cancellationToken);

                await OutputProtocol.WriteMessageEndAsync(cancellationToken);

                await OutputProtocol.Transport.FlushAsync(cancellationToken);

                var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken);

                if (msg.Type == TMessageType.Exception)
                {
                    var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken);

                    await InputProtocol.ReadMessageEndAsync(cancellationToken);

                    throw x;
                }

                var result = new InternalStructs.SendNotificationResult();
                await result.ReadAsync(InputProtocol, cancellationToken);

                await InputProtocol.ReadMessageEndAsync(cancellationToken);

                if (result.__isset.success)
                {
                    return(result.Success);
                }
                if (result.__isset.ne)
                {
                    throw result.Ne;
                }
                throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "SendNotification failed: unknown result");
            }
예제 #32
0
파일: Hbase.cs 프로젝트: nordbergm/HBaseNet
 public bool Process(TProtocol iprot, TProtocol oprot)
 {
     try
     {
         TMessage msg = iprot.ReadMessageBegin();
         ProcessFunction fn;
         this.processMap_.TryGetValue(msg.Name, out fn);
         if (fn == null)
         {
             TProtocolUtil.Skip(iprot, TType.Struct);
             iprot.ReadMessageEnd();
             var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod,
                                               "Invalid method name: '" + msg.Name + "'");
             oprot.WriteMessageBegin(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID));
             x.Write(oprot);
             oprot.WriteMessageEnd();
             oprot.Transport.Flush();
             return true;
         }
         fn(msg.SeqID, iprot, oprot);
     }
     catch (IOException)
     {
         return false;
     }
     return true;
 }