Skip to content

Commit

Permalink
catch DBusErrorResponse (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReimarBauer authored Aug 25, 2023
1 parent 82ee078 commit 9974ed5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion mslib/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
import logging
import keyring


try:
from jeepney.wrappers import DBusErrorResponse
except (ImportError, ModuleNotFoundError):
class DBusErrorResponse(Exception):
"""
Fallback definition on not DBus systems
"""
def __init__(self, message):
super().__init__(message)

from mslib.msui import constants


Expand Down Expand Up @@ -64,7 +75,7 @@ def get_password_from_keyring(service_name=NAME, username=""):
return None
else:
return cred.password
except (keyring.errors.KeyringLocked, keyring.errors.InitError) as ex:
except (keyring.errors.KeyringLocked, keyring.errors.InitError, DBusErrorResponse) as ex:
logging.warn(ex)
return None

Expand Down

0 comments on commit 9974ed5

Please sign in to comment.