Example #1
0
        public static async Task Dispatch <TInput>([NotNull] this ICommandDispatcher commandDispatcher, [NotNull] TInput input)
        {
            if (commandDispatcher == null)
            {
                throw new ArgumentNullException(nameof(commandDispatcher));
            }

            var success = await commandDispatcher.TryDispatch(input);

            if (!success)
            {
                throw new InvalidOperationException($"processing of '{typeof(TInput)}' failed");
            }
        }