Non Dev Environment - User Friendly Error Page
Closed this issue · 4 comments
Since
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
is replaced by
settings.UseExceptionalPageOnThrow = _currentEnvironment.IsDevelopment();
How can I specify a user friendly error page for the non dev environments such as production?
Yo can use the same if/else
logic to do whatever you want in prod there, so for example:
if (!env.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
}
After I did this it stopped logging exceptions to the DB when I am not in a developer environment.
Is this the expected behavior?
How can I display a friendly error page in the non dev environment, but have exceptional still log the error to the DB?
@kellielellie1 Sorry I missed this - the middleware is what's going to log, you want it after any error page handler so that it logs before it gets there. It's the exception handler redirecting that preventing us from seeing/logging the error most likely.
Happy to reopen with more info - tidying up for now!