handle missing KeePass entry

This commit is contained in:
Stefan Bühler 2023-05-10 16:00:07 +02:00
parent 21069e892e
commit 1a9829b93b

View File

@ -148,6 +148,8 @@ class Keepass(PasswordManager):
password = getpass.getpass(f"KeePass password for database {self.database}: ") password = getpass.getpass(f"KeePass password for database {self.database}: ")
kp = pykeepass.PyKeePass(self.database, password=password) kp = pykeepass.PyKeePass(self.database, password=password)
entry = kp.find_entries(username=password_name, first=True) entry = kp.find_entries(username=password_name, first=True)
if not entry:
raise SystemExit(f"no KeePass entry for {password_name!r} found")
return entry.password # type: ignore return entry.password # type: ignore