Пример #1
0
        /// <summary>
        /// Processes the provided resolution context against this action result instance to
        /// generate the expected response in accordance with this instance's rule set.
        /// </summary>
        /// <param name="context">The context being processed.</param>
        /// <returns>Task.</returns>
        public Task Complete(ResolutionContext context)
        {
            if (_invokeDef != null)
            {
                context.Messages.Critical(
                    $"The field '{_invokeDef.Name}' was not found or could not be invoked.",
                    Constants.ErrorCodes.INVALID_ROUTE,
                    context.Request.Origin,
                    _thrownException);
            }
            else if (!string.IsNullOrWhiteSpace(_message))
            {
                context.Messages.Critical(
                    _message,
                    Constants.ErrorCodes.INVALID_ROUTE,
                    context.Request.Origin);
            }
            else
            {
                context.Messages.Critical(
                    $"The item was not routable or otherwise not available.",
                    Constants.ErrorCodes.INVALID_ROUTE,
                    context.Request.Origin);
            }

            context.Cancel();
            return(Task.CompletedTask);
        }
        /// <summary>
        /// Processes the provided resolution context against this action result instance to
        /// generate the expected response in accordance with this instance's rule set.
        /// </summary>
        /// <param name="context">The context being processed.</param>
        /// <returns>Task.</returns>
        public Task Complete(ResolutionContext context)
        {
            context.Messages.Critical(
                _errorMessage,
                _errorCode,
                context.Request.Origin);

            context.Cancel();
            return(Task.CompletedTask);
        }
        /// <summary>
        /// Processes the provided resolution context against this action result instance to
        /// generate the expected response in accordance with this instance's rule set.
        /// </summary>
        /// <param name="context">The context being processed.</param>
        /// <returns>Task.</returns>
        public Task Complete(ResolutionContext context)
        {
            var message = _errorMessage ?? $"An unhandled exception was thrown during the execution of field '{_action?.Name ?? "-unknown-"}'.";

            context.Messages.Critical(
                message,
                Constants.ErrorCodes.UNHANDLED_EXCEPTION,
                context.Request.Origin,
                _exception);

            context.Cancel();
            return(Task.CompletedTask);
        }
        /// <summary>
        /// Processes the provided resolution context against this action result instance to
        /// generate the expected response in accordance with this instance's rule set.
        /// </summary>
        /// <param name="context">The context being processed.</param>
        /// <returns>Task.</returns>
        public Task Complete(ResolutionContext context)
        {
            if (_customMessage != null)
            {
                context.Messages.Add(_customMessage);
            }
            else
            {
                context.Messages.Critical(
                    _message ?? "An unhandled exception occured.",
                    _code,
                    context.Request.Origin,
                    _exception);
            }

            context.Cancel();
            return(Task.CompletedTask);
        }
Пример #5
0
 /// <summary>
 /// Processes the provided resolution context against this action result instance to
 /// generate the expected response in accordance with this instance's rule set.
 /// </summary>
 /// <param name="context">The context being processed.</param>
 /// <returns>Task.</returns>
 public Task Complete(ResolutionContext context)
 {
     context.Cancel();
     return(Task.CompletedTask);
 }