I’ve been playing around with my error handling and noticed a little while ago that my middleware-set headers were being reset when errors were thrown. Playing around a bit more, it seems that it’s only exceptions that are manually thrown.
Besides repeating my middleware in my error handling, is there any way to make thrown exceptions still traverse the middleware stack? It makes things quite complicated when it comes to setting headers, logging, etc.
Edit: for not found and method not allowed only is this true. For php errors and exceptions thrown during the script it also does not traverse the middleware.