As I see it, you would probably not do a redirect for it to hit a error page.
To me this seems like a bad practice, since that error is occurring in that specific place, you should not move a visitor somewhere else.
Let a page fail, keep the url etc. intact for swap the View to a error page result.
What I usually do is just add the app.UseExceptionHandler("/error");
and then have a Error.cshtml
to render a basic page.
I don’t tend to make any integration into Umbraco data etc. since I can’t guarantee that Umrbaco works when this page is hit.
It still produces a 200OK result, but that I fine since otherwise, as Luuk wrote, the browser would handle the rendering differently.
This could cause your HTML to just be ignored and the browser default error page to show.
Also when you say this:
I can’t help but think that if you have an API Controller you maintain, then why not wrap the body in a try/catch and return a ProblemDetails response?
I may be assuming too much, but to me it sounds like you make an API call, in which case I don’t think you should show a whole view page.