summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-02-01 22:05:40 +0100
committerMichał Górny <mgorny@gentoo.org>2018-02-01 22:05:40 +0100
commit2c7c78cfc98444ecc30b5c14f9f3b688f243674e (patch)
tree96b6bdfd90f50bc9dc4bd1b145783dc7f7a3c98e
parent3753bb44c4e7f94e5b1895f52ae9e41be9b100f2 (diff)
downloadgemato-2c7c78cfc98444ecc30b5c14f9f3b688f243674e.tar.gz
exceptions: Add a base OpenPGPRuntimeError class
-rw-r--r--gemato/exceptions.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/gemato/exceptions.py b/gemato/exceptions.py
index abaa730..f565cd5 100644
--- a/gemato/exceptions.py
+++ b/gemato/exceptions.py
@@ -99,22 +99,28 @@ class ManifestUnsignedData(GematoException):
return "Unsigned data found in an OpenPGP signed Manifest"
-class OpenPGPVerificationFailure(GematoException):
+class OpenPGPRuntimeError(GematoException):
"""
- An exception raised when OpenPGP verification fails.
+ Base exception class for OpenPGP runtime errors.
"""
__slots__ = ['output']
def __init__(self, output):
- super(OpenPGPVerificationFailure, self).__init__(output)
+ super(OpenPGPRuntimeError, self).__init__(output)
self.output = output
+
+class OpenPGPVerificationFailure(OpenPGPRuntimeError):
+ """
+ An exception raised when OpenPGP verification fails.
+ """
+
def __str__(self):
return "OpenPGP verification failed:\n{}".format(self.output)
-class OpenPGPExpiredKeyFailure(OpenPGPVerificationFailure):
+class OpenPGPExpiredKeyFailure(OpenPGPRuntimeError):
"""
OpenPGP verification rejected because of expired key.
"""
@@ -123,7 +129,7 @@ class OpenPGPExpiredKeyFailure(OpenPGPVerificationFailure):
return "OpenPGP signature rejected because of expired key:\n{}".format(self.output)
-class OpenPGPRevokedKeyFailure(OpenPGPVerificationFailure):
+class OpenPGPRevokedKeyFailure(OpenPGPRuntimeError):
"""
OpenPGP verification rejected because of revoked key.
"""
@@ -132,7 +138,7 @@ class OpenPGPRevokedKeyFailure(OpenPGPVerificationFailure):
return "OpenPGP signature rejected because of revoked key:\n{}".format(self.output)
-class OpenPGPUnknownSigFailure(OpenPGPVerificationFailure):
+class OpenPGPUnknownSigFailure(OpenPGPRuntimeError):
"""
OpenPGP verification rejected for unknown reason (i.e. unrecognized
GPG status).
@@ -142,17 +148,11 @@ class OpenPGPUnknownSigFailure(OpenPGPVerificationFailure):
return "OpenPGP signature rejected for unknown reason:\n{}".format(self.output)
-class OpenPGPSigningFailure(GematoException):
+class OpenPGPSigningFailure(OpenPGPRuntimeError):
"""
An exception raised when OpenPGP signing fails.
"""
- __slots__ = ['output']
-
- def __init__(self, output):
- super(OpenPGPSigningFailure, self).__init__(output)
- self.output = output
-
def __str__(self):
return "OpenPGP signing failed:\n{}".format(self.output)