From 006b5e25b21cb1b219288029f6a988b0eda20b87 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Dec 2021 11:22:37 +0100 Subject: [PATCH] Also catch unknown keyring errors We're confident now that we get it to not crash for most normal cases. If there is a crash here it's due to the internals of Keyring. We're catching all of the others separately anyway. Fixes Sentry issue CURA-340. --- cura/OAuth2/KeyringAttribute.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cura/OAuth2/KeyringAttribute.py b/cura/OAuth2/KeyringAttribute.py index 35ffdcbd24..58b45a67ef 100644 --- a/cura/OAuth2/KeyringAttribute.py +++ b/cura/OAuth2/KeyringAttribute.py @@ -5,7 +5,7 @@ from typing import Type, TYPE_CHECKING, Optional, List from io import BlockingIOError import keyring from keyring.backend import KeyringBackend -from keyring.errors import NoKeyringError, PasswordSetError, KeyringLocked +from keyring.errors import NoKeyringError, PasswordSetError, KeyringLocked, KeyringError from UM.Logger import Logger @@ -53,6 +53,10 @@ class KeyringAttribute: self._store_secure = False Logger.log("w", "The password retrieved from the keyring cannot be used because it contains characters that cannot be decoded.") return getattr(instance, self._name) + except KeyringError: + self._store_secure = False + Logger.logException("w", "Unknown keyring error.") + return getattr(instance, self._name) else: return getattr(instance, self._name)