-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PROCESSING] [regression] One more fix for broken encoding of psycopg…
…2 error messages
- Loading branch information
1 parent
0b76352
commit 2c8e03d
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,7 +205,7 @@ def __init__(self, host=None, port=None, dbname=None, user=None, | |
break | ||
except psycopg2.OperationalError as e: | ||
if i == 3: | ||
raise DbError(unicode(e)) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
borysiasty
Author
Member
|
||
raise DbError(unicode(e.pgerror, e.cursor.connection.encoding, 'replace')) | ||
|
||
err = unicode(e) | ||
user = self.uri.username() | ||
|
@@ -821,7 +821,7 @@ def _exec_sql(self, cursor, sql): | |
try: | ||
cursor.execute(sql) | ||
except psycopg2.Error as e: | ||
raise DbError(unicode(e), e.cursor.query) | ||
raise DbError(unicode(e.pgerror, e.cursor.connection.encoding, 'replace'), e.cursor.query) | ||
|
||
def _exec_sql_and_commit(self, sql): | ||
"""Tries to execute and commit some action, on error it rolls | ||
|
Can't the
unicode
conversion simply be dropped? The less casting, the less information loss.