1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-19 18:37:39 +03:00

Merge pull request #1001 from A-UNDERSCORE-D/fix/unicode-error-error

Fixed edge case with reading old ship loadout
This commit is contained in:
Athanasius 2021-04-12 19:04:32 +01:00 committed by GitHub
commit c2dec59e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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")