Esempio n. 1
0
        private static async Task <IRestResponse> Execute(Func <Task <IRestResponse> > ask, IRestRequest request, CancellationToken ct)
        {
            IRestResponse response;

            if (!ct.IsCancellationRequested)
            {
                LogRequest(request, "Sending");
                try
                {
                    response = await ask();

                    LogResponse(response, "Received");
                }
                catch (Exception e)
                {
                    var tie = new TrelloInteractionException(e);
                    response = new NullRestResponse {
                        Exception = e
                    };
                    TrelloConfiguration.Log.Error(tie);
                }
            }
            else
            {
                LogRequest(request, "Stubbing");
                response = new NullRestResponse();
            }

            return(response);
        }
Esempio n. 2
0
        private static async Task <IRestResponse> Process(Func <Task <IRestResponse> > ask, IRestRequest request, CancellationToken ct)
        {
            IRestResponse response;

            try
            {
                response = await Execute(ask, request, ct);
            }
            catch (Exception e)
            {
                response = new NullRestResponse {
                    Exception = e
                };
                TrelloConfiguration.Log.Error(e);
            }

            return(response);
        }