diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2020-03-02 23:45:35 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-03-02 23:45:35 +0000 |
| commit | b5050beb73b2e50b122c36e7dcdc06abffd472f2 (patch) | |
| tree | 6679019ff418d6c346d5bd4cdc4aab4a73d9303e /lib/sqlalchemy/dialects/postgresql | |
| parent | 2d052d43518a0f4d9751db7e699cfebd3724c1e5 (diff) | |
| parent | 57dc36a01b2b334a996f73f6a78b3bfbe4d9f2ec (diff) | |
| download | sqlalchemy-b5050beb73b2e50b122c36e7dcdc06abffd472f2.tar.gz | |
Merge "Ensure all nested exception throws have a cause"
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/psycopg2.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index 0b6afc337..1b1c9b0ba 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -763,11 +763,14 @@ class PGDialect_psycopg2(PGDialect): def set_isolation_level(self, connection, level): try: level = self._isolation_lookup[level.replace("_", " ")] - except KeyError: - raise exc.ArgumentError( - "Invalid value '%s' for isolation_level. " - "Valid isolation levels for %s are %s" - % (level, self.name, ", ".join(self._isolation_lookup)) + except KeyError as err: + util.raise_( + exc.ArgumentError( + "Invalid value '%s' for isolation_level. " + "Valid isolation levels for %s are %s" + % (level, self.name, ", ".join(self._isolation_lookup)) + ), + replace_context=err, ) connection.set_isolation_level(level) |
