DBus authentication failure in jeepney doesn't get wrapped in SecretServiceNotAvailableException
Closed this issue · 2 comments
This epic was started by JonnyJD/musicbrainz-isrcsubmit#119.
When jeepney (and in turn secretstorage) is used in a fakeroot environment, DBus authentication fails.
- This causes DBus to return "REJECTED EXTERNAL", triggering a
raise Exception()
here. Or at least it would, if not for this coding error. Right now it raises theValueError
seen in the isrcsubmit issue above. dbus_init()
only checks forKeyError
andConnectionError
, thus allowing theException
/ValueError
through.
dbus_init
should probably check for this failure mode of jeepney too. Right now, that's a little difficult, with it either raising a generic Exception
or ValueError
- both of which are pretty much catch-alls. If you're fine with that, __init__.py:44 could be modified to just catch any BaseException
and wrap that, which in my opinion is a valid use of a catch-all - it's just being wrapped in another exception, after all.
Alternatively, we could wait for this other jeepney MR to go through, which raises a special exception in the case of an authentication failure. That could take quite a while though, I don't think that maintainer is particularly active and propagation might also take some time.
I will catch ValueError for now, as this is what the current buggy code raises. When your merge requests are merged, the new class will inherit from ValueError too, so we can avoid catching the too generic Exception class.
I have just released version 3.1.0, which includes this change.