diff options
Diffstat (limited to 'cryptech/py11/exceptions.py')
-rw-r--r-- | cryptech/py11/exceptions.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cryptech/py11/exceptions.py b/cryptech/py11/exceptions.py index 7f86fe4..9512cda 100644 --- a/cryptech/py11/exceptions.py +++ b/cryptech/py11/exceptions.py @@ -28,6 +28,11 @@ class CKR_Exception(Exception): def __int__(self): return self.ckr_code + @classmethod + def raise_on_failure(cls, rv, func, *args): + if rv != CKR_OK: + raise cls.ckr_map[rv] + CKR_OK = 0x00000000 class CKR_CANCEL (CKR_Exception): ckr_code = 0x00000001 |