private async Task <IResponse <TRequestResult> > GetResponse(IObjectLogger logger, IResponseComposer responseComposer)
 {
     try
     {
         return(await this.Request());
     }
     catch (Exception e)
     {
         logger.LogCritical(e);
         return(responseComposer.Error <TRequestResult>(e));
     }
 }
        private async Task <IResponse <TRequestResult> > GetResponse(IResponse <TFrom> parentResult, IObjectLogger logger, IResponseComposer responseComposer)
        {
            Debug.Assert(parentResult != null);

            try
            {
                return(this.Request != null
                    ? await this.Request(parentResult.Payload)
                    : throw new InvalidOperationException("Provider is null"));
            }
            catch (Exception e)
            {
                logger.LogCritical(e);
                return(responseComposer.Error <TRequestResult>(e));
            }
        }
        public override async Task <IResponse <TResult> > GetResult(IObjectLogger logger, IResponseComposer responseComposer)
        {
            Debug.Assert(logger != null);

            try
            {
                var requestResult = this.ProcessResponse(logger, await this.GetResponse(logger, responseComposer));

                Debug.Assert(requestResult != null);

                return(await this.TransformFunc(requestResult, responseComposer, logger));
            }
            catch (Exception e)
            {
                logger.LogCritical(e);
                return(responseComposer.Error <TResult>(e));
            }
        }
        public override async Task <IResponse <TResult> > GetResult(IObjectLogger logger, IResponseComposer responseComposer)
        {
            Debug.Assert(this.Parent != null);
            Debug.Assert(this.Request != null);

            try
            {
                var parentResult = await this.Parent.GetResult(logger, responseComposer);

                if (!parentResult.Succeeded)
                {
                    return(responseComposer.From <TFrom, TResult>(parentResult));
                }

                var response = this.ProcessResponse(logger, await this.GetResponse(parentResult, logger, responseComposer));

                return(await this.TransformFunc(parentResult, response, responseComposer, logger));
            }
            catch (Exception e)
            {
                logger.LogCritical(e);
                return(responseComposer.Error <TResult>(e));
            }
        }