/// <summary> /// Initializes a new instance of the <see cref="ErrorHandlerCommandStrategy"/> class. /// </summary> /// <param name="errorHandler">Error handler</param> public ErrorHandlerCommandStrategy(IDynamicCommandErrorHandler errorHandler) { _errorHandler = errorHandler; }
/// <summary> /// Will catch any exception thrown by the execution of the command and delegate it to the specified error handler. /// </summary> /// <param name="builder">The builder.</param> /// <param name="errorHandler">Error handler</param> /// <returns><see cref="IDynamicCommandBuilder"/></returns> public static IDynamicCommandBuilder CatchErrors(this IDynamicCommandBuilder builder, IDynamicCommandErrorHandler errorHandler) => builder.WithStrategy(new ErrorHandlerCommandStrategy(errorHandler));