We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to add a global exception handler for all commands.
The default behavior is that all exceptions are catched by the handler in HandleExceptionAndExitMiddleware.
HandleExceptionAndExitMiddleware
I have tried to add another middleware to intercept the exception:
var builder = CoconaApp.CreateBuilder(args); var app = builder.Build(); var commandDispatcher = app.Services.GetRequiredService<ICoconaCommandDispatcherPipelineBuilder>(); commandDispatcher.UseMiddleware<MyExceptionHandlerMiddleware>();
That does not work, and my understanding is that the HandleExceptionAndExitMiddleware is added later and takes precedence over my own middleware.
Is there any other way to intercept the exceptions ?
The text was updated successfully, but these errors were encountered:
You can apply filters with app.UseFilter to handle exceptions in the same way as middleware.
app.UseFilter
Sorry, something went wrong.
Thanks, that's what I was looking for. Sorry for not having found that by myself...
Successfully merging a pull request may close this issue.
I would like to add a global exception handler for all commands.
The default behavior is that all exceptions are catched by the handler in
HandleExceptionAndExitMiddleware
.I have tried to add another middleware to intercept the exception:
That does not work, and my understanding is that the
HandleExceptionAndExitMiddleware
is added later and takes precedence over my own middleware.Is there any other way to intercept the exceptions ?
The text was updated successfully, but these errors were encountered: