Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ErrorHandlerCommandStrategy"/> class.
 /// </summary>
 /// <param name="errorHandler">Error handler</param>
 public ErrorHandlerCommandStrategy(IDynamicCommandErrorHandler errorHandler)
 {
     _errorHandler = errorHandler;
 }
Exemple #2
0
 /// <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));