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
Samarbeta med oss på GitHub
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.