From 6d5eae78a7dd79ad7bd0a0951bc6c95437d0fa8e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 7 Dec 2013 17:20:05 -0500 Subject: - A DBAPI that raises an error on ``connect()`` which is not a subclass of dbapi.Error (such as ``TypeError``, ``NotImplementedError``, etc.) will propagate the exception unchanged. Previously, the error handling specific to the ``connect()`` routine would both inappropriately run the exception through the dialect's :meth:`.Dialect.is_disconnect` routine as well as wrap it in a :class:`sqlalchemy.exc.DBAPIError`. It is now propagated unchanged in the same way as occurs within the execute process. [ticket:2881] - add tests for this in test_parseconnect, but also add tests in test_execute to ensure the execute() behavior as well --- lib/sqlalchemy/engine/strategies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/engine/strategies.py b/lib/sqlalchemy/engine/strategies.py index ab9d370a3..5a3b2c5af 100644 --- a/lib/sqlalchemy/engine/strategies.py +++ b/lib/sqlalchemy/engine/strategies.py @@ -78,7 +78,7 @@ class DefaultEngineStrategy(EngineStrategy): def connect(): try: return dialect.connect(*cargs, **cparams) - except Exception as e: + except dialect.dbapi.Error as e: invalidated = dialect.is_disconnect(e, None, None) util.raise_from_cause( exc.DBAPIError.instance(None, None, -- cgit v1.2.1