Skip to content

Commit 2c8e03d

Browse files
committed
[PROCESSING] [regression] One more fix for broken encoding of psycopg2 error messages
1 parent 0b76352 commit 2c8e03d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/plugins/processing/tools/postgis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def __init__(self, host=None, port=None, dbname=None, user=None,
205205
break
206206
except psycopg2.OperationalError as e:
207207
if i == 3:
208-
raise DbError(unicode(e))
208+
raise DbError(unicode(e.pgerror, e.cursor.connection.encoding, 'replace'))
209209

210210
err = unicode(e)
211211
user = self.uri.username()
@@ -821,7 +821,7 @@ def _exec_sql(self, cursor, sql):
821821
try:
822822
cursor.execute(sql)
823823
except psycopg2.Error as e:
824-
raise DbError(unicode(e), e.cursor.query)
824+
raise DbError(unicode(e.pgerror, e.cursor.connection.encoding, 'replace'), e.cursor.query)
825825

826826
def _exec_sql_and_commit(self, sql):
827827
"""Tries to execute and commit some action, on error it rolls

0 commit comments

Comments
 (0)