Ejemplo n.º 1
0
        public async Task <GadgetResponse <TResult> > ExecuteAsync(TRequest request)
        {
            this.Logger.LogDebug("Executing Gadget base functionality");
            var response = new GadgetResponse <TResult>();

            if (this.IsDisabled)
            {
                response.Error = "This gadget is disabled";
            }
            else
            {
                try
                {
                    this.Logger.LogDebug("Executing Gadget core functionality");
                    response.Result = await ExecuteCoreAsync(request);

                    this.Logger.LogDebug("Executed Gadget core functionality");
                }
                catch (Exception exc)
                {
                    this.Logger.LogError(exc, "Exception while executing Gadget core functionality");
                    response.Error = exc.ToString();
                }
            }
            response.ChainedResponse = await this.PerformCallChainAsync(request);

            response.TimeCompleted = DateTimeOffset.UtcNow;
            this.Logger.LogDebug("Executed Gadget base functionality");
            return(response);
        }
Ejemplo n.º 2
0
        public async Task <GadgetResponse <TResult> > ExecuteAsync(TRequest request)
        {
            var response = new GadgetResponse <TResult>();

            try
            {
                response.Result = await ExecuteCoreAsync(request);
            }
            catch (Exception exc)
            {
                response.Error = exc.ToString();
            }
            response.ChainedResponse = await this.PerformCallChainAsync(request);

            response.TimeCompleted = DateTimeOffset.UtcNow;
            return(response);
        }