diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-12-04 11:55:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-04 11:55:52 +0100 |
commit | ecc23188f4b88bef1f08a8fac2779720308863d6 (patch) | |
tree | b41761dfa8f6acab760c3a9deb78dd0afa34d22f /synapse/storage/_base.py | |
parent | Merge pull request #4244 from aaronraimist/drop-sent-txt (diff) | |
download | synapse-ecc23188f4b88bef1f08a8fac2779720308863d6.tar.xz |
Fix UnicodeDecodeError when postgres is not configured in english (#4253)
This is a bit of a half-assed effort at fixing https://github.com/matrix-org/synapse/issues/4252. Fundamentally the right answer is to drop support for Python 2.
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r-- | synapse/storage/_base.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index d9d0255d0b..38e7d26365 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -29,6 +29,7 @@ from synapse.api.errors import StoreError from synapse.storage.engines import PostgresEngine from synapse.util.caches.descriptors import Cache from synapse.util.logcontext import LoggingContext, PreserveLoggingContext +from synapse.util.stringutils import exception_to_unicode logger = logging.getLogger(__name__) @@ -249,32 +250,32 @@ class SQLBaseStore(object): except self.database_engine.module.OperationalError as e: # This can happen if the database disappears mid # transaction. - logger.warn( + logger.warning( "[TXN OPERROR] {%s} %s %d/%d", - name, e, i, N + name, exception_to_unicode(e), i, N ) if i < N: i += 1 try: conn.rollback() except self.database_engine.module.Error as e1: - logger.warn( + logger.warning( "[TXN EROLL] {%s} %s", - name, e1, + name, exception_to_unicode(e1), ) continue raise except self.database_engine.module.DatabaseError as e: if self.database_engine.is_deadlock(e): - logger.warn("[TXN DEADLOCK] {%s} %d/%d", name, i, N) + logger.warning("[TXN DEADLOCK] {%s} %d/%d", name, i, N) if i < N: i += 1 try: conn.rollback() except self.database_engine.module.Error as e1: - logger.warn( + logger.warning( "[TXN EROLL] {%s} %s", - name, e1, + name, exception_to_unicode(e1), ) continue raise |