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.
This commit is contained in:
Ghostkeeper 2021-12-13 11:22:37 +01:00
parent 5567cc480e
commit 006b5e25b2
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

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