1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 08:40:34 +03:00

Fixed edge case with reading old ship loadout

This commit is contained in:
A_D 2021-04-12 19:58:23 +02:00
parent 2da92c1f39
commit 1a9983f331
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -1265,6 +1265,13 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
except OSError:
logger.exception("OSError reading old ship loadout default encoding.")
except ValueError:
# User was on $OtherEncoding, updated windows to be sane and use utf8 everywhere, thus
# the above open() fails, likely with a UnicodeDecodeError, which subclasses UnicodeError which
# subclasses ValueError, this catches ValueError _instead_ of UnicodeDecodeError just to be sure
# that if some other encoding error crops up we grab it too.
logger.exception('ValueError when reading old ship loadout default encoding')
except OSError:
logger.exception("OSError reading old ship loadout with default encoding")