diff options
author | Ghostkeeper <rubend@tutanota.com> | 2022-05-20 13:55:59 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2022-05-20 13:55:59 +0300 |
commit | b5e3479c1c8e9f76cb6bbf23434bedae178a6c39 (patch) | |
tree | cc5b932c6fec9e3c113a171cbe2e425b44dd78d7 | |
parent | 64b29779ca808119458eb52d0add91a87c9a25b6 (diff) |
Catch UnicodeDecodeErrors when parsing error messages from server
Stupid recursive errors.
Fixes Sentry issue CURA-3VB.
-rw-r--r-- | plugins/Marketplace/PackageList.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/Marketplace/PackageList.py b/plugins/Marketplace/PackageList.py index 30162afe6c..3306e10740 100644 --- a/plugins/Marketplace/PackageList.py +++ b/plugins/Marketplace/PackageList.py @@ -244,7 +244,10 @@ class PackageList(ListModel): def _downloadError(self, package_id: str, update: bool = False, reply: Optional["QNetworkReply"] = None, error: Optional["QNetworkReply.NetworkError"] = None) -> None: if reply: - reply_string = bytes(reply.readAll()).decode() + try: + reply_string = bytes(reply.readAll()).decode() + except UnicodeDecodeError: + reply_string = "<error message is corrupt too>" Logger.error(f"Failed to download package: {package_id} due to {reply_string}") self._package_manager.packageInstallingFailed.emit(package_id) |