private static ActionResult DefaultErrorTransformCore(ExecutionErrorCollection errors,
                                                              ExecutionHostController controller)
        {
            var firstError = errors.First();

            var problemDetails = new ProblemDetails()
            {
                Type     = "about:blank",
                Instance = controller.Request.GetEncodedUrl(),
                Status   = (int)firstError.Type,
                Detail   = firstError.Message,
                Title    = firstError.Type.ToString()
            };

            if (firstError.Type == ExecutionErrorType.ValidationFailed)
            {
                problemDetails = new ValidationProblemDetails()
                {
                    Type     = problemDetails.Type,
                    Instance = problemDetails.Instance,
                    Status   = problemDetails.Status,
                    Detail   = problemDetails.Detail,
                    Title    = problemDetails.Title,
                    Errors   = { { problemDetails.Title,
                                   errors.Where(e => e.Type == ExecutionErrorType.ValidationFailed)
                                   .Select(e => e.Message).ToArray() } }
                };
            }

            return(new ObjectResult(problemDetails)
            {
                StatusCode = problemDetails.Status
            });
        }
 internal SingleResponseTransformer(Task <ExecutionResult <TResponse> > source, ExecutionHostController controller)
 {
     this.source     = source;
     this.controller = controller;
 }
 internal ActionResultTransformer(Task <ValueOrError <T> > source, ExecutionHostController controller)
 {
     this.source     = source;
     this.controller = controller;
 }
 private static ActionResult DefaultSuccessTransformCore(T value, ExecutionHostController controller)
 {
     return(new OkObjectResult(value));
 }