I would like to create WSGI middleware to handle an exception. However, Flask always catches the exception before it reaches the middleware. How can I raise an exception and catch it outside of Flask?
I don't want to let Flask handle this because I want to be able to use the middleware with other WSGI applications besides Flask.