CommandLineBuilderExtensions.UseExceptionHandler Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Enables an exception handler to catch any unhandled exceptions thrown by a command handler during invocation.
public static System.CommandLine.Builder.CommandLineBuilder UseExceptionHandler(this System.CommandLine.Builder.CommandLineBuilder builder, Action<Exception,System.CommandLine.Invocation.InvocationContext>? onException = default, int? errorExitCode = default);
static member UseExceptionHandler : System.CommandLine.Builder.CommandLineBuilder * Action<Exception, System.CommandLine.Invocation.InvocationContext> * Nullable<int> -> System.CommandLine.Builder.CommandLineBuilder
<Extension()>
Public Function UseExceptionHandler (builder As CommandLineBuilder, Optional onException As Action(Of Exception, InvocationContext) = Nothing, Optional errorExitCode As Nullable(Of Integer) = Nothing) As CommandLineBuilder
Parameters
- builder
- CommandLineBuilder
A command line builder.
- onException
- Action<Exception,InvocationContext>
A delegate that will be called when an exception is thrown by a command handler.
Returns
The same instance of CommandLineBuilder.
Applies to
Colaborar conosco no GitHub
A fonte deste conteúdo pode ser encontrada no GitHub, onde você também pode criar e revisar problemas e solicitações de pull. Para obter mais informações, confira o nosso guia para colaboradores.