Created
June 14, 2023 03:18
-
-
Save AnthonyGiretti/ca7b8404ecbbb0255b723a4fa194ef1d to your computer and use it in GitHub Desktop.
Register in order two chained Exception handlers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DemoAspNetCore8.ErrorHandling; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddExceptionHandler<TimeOutExceptionHandler>(); | |
builder.Services.AddExceptionHandler<DefaultExceptionHandler>(); | |
var app = builder.Build(); | |
app.UseExceptionHandler(opt => { }); | |
app.MapGet("/Exception", () => { | |
throw new NotImplementedException(); | |
}); | |
app.MapGet("/Timeout", () => { | |
throw new TimeoutException(); | |
}); | |
app.Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment