josephwoodward / GlobalExceptionHandlerDotNet

Exception handling as a convention in the ASP.NET Core request pipeline
MIT License
272 stars 32 forks source link

Handling a specific exception in MVC Core 2.1 #27

Closed kinetiq closed 5 years ago

kinetiq commented 5 years ago

I'm hoping you can point me in the right direction... There's a certain exception that occurs in my project, and when it happens, I want to show a special error message to advise the user. My research has led me here.

Couple quick questions:

In case you want more background... In my project, I'm using a 3rd party auth provider, Auth0, and I'm using their hosted login page. If a user ever goes to a stale login page (> 15m old), we end up with a Correlation Failed error, and one way to handle it may be with global exception handling. But I'm concerned this is all wild overkill, of course.

Thanks for your time!

josephwoodward commented 5 years ago

Is this a reasonable use of GlobalExceptionHandlerDotNet? It seems a little more focused on WebAPI. I don't want to do anything that interferes with AppInsights/New Relic exception logging, etc.

Yes, this is correct. GlobalExceptionHandler at this moment in time is tailored towards WebAPI so is not capable of redirecting to a different route if an exception is handled. I've considered making an MVC version that would reroute based on exceptions but at the at the moment this can't be done.

kinetiq commented 5 years ago

Thanks for the info :) I think that would be a great use case, for what it's worth.