Skip to content

Commit

Permalink
[PROCESSING] [regression] One more fix for broken encoding of psycopg…
Browse files Browse the repository at this point in the history
…2 error messages
  • Loading branch information
borysiasty committed Jun 3, 2017
1 parent 0b76352 commit 2c8e03d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/tools/postgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
raise DbError(unicode(e.pgerror, e.cursor.connection.encoding, 'replace'))

err = unicode(e)
user = self.uri.username()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2c8e03d

Please sign in to comment.