Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
werkzeug times out when exception is raised #1536
I found this within a large Flask application but I managed to reproduce it.
SQLAlchemy's exceptions contain an
from werkzeug.wrappers import Request, Response from sqlalchemy import create_engine, text from sqlalchemy.exc import DatabaseError engine = create_engine('sqlite://') @Request.application def application(request): try: engine.execute(text('SELECT undefined_function()')) except DatabaseError as exc: # if we just re-raise, it works fine # raise # exc.orig is definitely an exception assert isinstance(exc.orig, Exception) # werkzeug doesn't return a response when this is raised raise exc.orig return Response('This is unreachable') if __name__ == '__main__': from werkzeug.serving import run_simple run_simple('localhost', 4000, application, use_debugger=True)
The same happens for a PostgreSQL (psycopg2) connection.