add new error class for certificate operations

---

 ipalib/errors.py |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/ipalib/errors.py b/ipalib/errors.py
index 1c358cd..f23a636 100644
--- a/ipalib/errors.py
+++ b/ipalib/errors.py
@@ -89,7 +89,9 @@ current block assignments:
 
             - **4200 - 4299**  `LDAPError` and its subclasses
 
-            - **4300 - 4999**  *Reserved for future use*
+            - **4300 - 4399**  `CertificateError` and its subclasses
+
+            - **4400 - 4999**  *Reserved for future use*
 
         - **5000 - 5999**  `GenericError` and its subclasses
 
@@ -1155,6 +1157,31 @@ class ObjectclassViolation(ExecutionError):
     format = _('%(info)s')
 
 
+class CertificateError(ExecutionError):
+    """
+    **4300** Base class for Certificate execution errors (*4300 - 4399*).
+    """
+
+    errno = 4300
+
+
+class CertificateOperationError(ExecutionError):
+    """
+    **4301** Raised when a certificate operation cannot be completed
+
+    For example:
+
+    >>> raise CertificateOperationError(error=u'bad serial number')
+    Traceback (most recent call last):
+      ...
+    CertificateOperationError: Certificate operation cannot be completed: bad 
serial number
+
+    """
+
+    errno = 4301
+    format = _('Certificate operation cannot be completed: %(error)s')
+
+
 ##############################################################################
 # 5000 - 5999: Generic errors
 
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to