diff options
author | Johannes Kulick <kulick@hildensia.de> | 2012-12-19 11:54:56 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-02-19 10:10:08 +0000 |
commit | 9b8b8f5a68270912ac0dc8f16d320729b25d2da8 (patch) | |
tree | 89389307a1afa881c782e5202181c700e1a78fcf /alot/errors.py | |
parent | 591bd897f5473d7ad97f7b2ad37df1aac50386c9 (diff) |
add error codes
to avoid import ui stuff to crypto.py I added error codes to the GPGProblem
Exceptions. This way I can process them later, depending on the error code
Diffstat (limited to 'alot/errors.py')
-rw-r--r-- | alot/errors.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/alot/errors.py b/alot/errors.py index 881acf1f..a4169c3c 100644 --- a/alot/errors.py +++ b/alot/errors.py @@ -2,7 +2,21 @@ # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file +class GPGCode: + AMBIGUOUS_NAME = 1 + NOT_FOUND = 2 + BAD_PASSPHRASE = 3 + KEY_REVOKED = 4 + KEY_EXPIRED = 5 + KEY_INVALID = 6 + KEY_CANNOT_ENCRYPT = 7 + KEY_CANNOT_SIGN = 8 + INVALID_HASHH = 9 + class GPGProblem(Exception): """GPG Error""" - pass + def __init__(self, message, code): + self.code = code + self.message = message + Exception(message) |