I have an ASP.NET Core middleware component that is timing out within its public async Task Invoke(HttpContext context)
method. After requesting the middleware and waiting about two minutes, the site sends this message: "HTTP Error 502.3 - Bad Gateway." But the exception does not continue up the middleware chain, so the exception cannot be caught by my error logging middleware.
I'd like to log and e-mail it the same way I handle my other exceptions. The error might get logged in the stdout log, and that's nice, but I also need the e-mail sent. So where can information about errors like this be received and handled? Thank you.