Example #1
0
        /// <summary>
        /// Builds an operation that throws a <see cref="OpExecutionAbortedException"/>.
        /// </summary>
        /// <typeparam name="TValue">The type of value.</typeparam>
        /// <param name="details">OPTIONAL details to use with the exception.  DEFAULT is to omit details.</param>
        /// <returns>
        /// The operation.
        /// </returns>
        public static ThrowOpExecutionAbortedExceptionOp <TValue> Abort <TValue>(
            string details = null)
        {
            var result = new ThrowOpExecutionAbortedExceptionOp <TValue>(details);

            return(result);
        }
Example #2
0
        /// <inheritdoc />
        public TValue Execute(
            ThrowOpExecutionAbortedExceptionOp <TValue> operation)
        {
            if (operation == null)
            {
                throw new ArgumentNullException(nameof(operation));
            }

            throw new OpExecutionAbortedException(operation.Details, abortingOperation: operation);
        }
Example #3
0
        /// <inheritdoc />
        public async Task <TValue> ExecuteAsync(
            ThrowOpExecutionAbortedExceptionOp <TValue> operation)
        {
            if (operation == null)
            {
                throw new ArgumentNullException(nameof(operation));
            }

            await Task.FromResult(0);

            throw new OpExecutionAbortedException(operation.Details, abortingOperation: operation);
        }