catch all exception in load_public_key()

This commit is contained in:
Son NK 2020-11-25 14:31:14 +01:00
parent 4f211bba61
commit bb8c9451c4

View file

@ -21,8 +21,8 @@ class PGPException(Exception):
def load_public_key(public_key: str) -> str:
"""Load a public key into keyring and return the fingerprint. If error, raise Exception"""
import_result = gpg.import_keys(public_key)
try:
import_result = gpg.import_keys(public_key)
return import_result.fingerprints[0]
except Exception as e:
raise PGPException("Cannot load key") from e