diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-01-24 10:46:04 -0800 |
|---|---|---|
| committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-01-24 10:46:04 -0800 |
| commit | 12532f67a03c1681f455211b00315765311a17a5 (patch) | |
| tree | c6f82790339218517d82850772e6ffdc1c04d374 /cryptography | |
| parent | bb41bf4d798a6761889ea828f7d7f160f17b4132 (diff) | |
| parent | 81744df9e4a109e33743825be6493cffe3026e09 (diff) | |
| download | cryptography-12532f67a03c1681f455211b00315765311a17a5.tar.gz cryptography-12532f67a03c1681f455211b00315765311a17a5.tar.bz2 cryptography-12532f67a03c1681f455211b00315765311a17a5.zip | |
Merge pull request #505 from alex/system-error
Switch to using our own InternalError, instead of SystemError
Diffstat (limited to 'cryptography')
| -rw-r--r-- | cryptography/exceptions.py | 4 | ||||
| -rw-r--r-- | cryptography/hazmat/backends/commoncrypto/backend.py | 9 | ||||
| -rw-r--r-- | cryptography/hazmat/backends/openssl/backend.py | 6 |
3 files changed, 14 insertions, 5 deletions
diff --git a/cryptography/exceptions.py b/cryptography/exceptions.py index 44363c24..2654b453 100644 --- a/cryptography/exceptions.py +++ b/cryptography/exceptions.py @@ -34,3 +34,7 @@ class InvalidTag(Exception): class InvalidSignature(Exception): pass + + +class InternalError(Exception): + pass diff --git a/cryptography/hazmat/backends/commoncrypto/backend.py b/cryptography/hazmat/backends/commoncrypto/backend.py index 7193f1d8..4e70cab5 100644 --- a/cryptography/hazmat/backends/commoncrypto/backend.py +++ b/cryptography/hazmat/backends/commoncrypto/backend.py @@ -16,7 +16,9 @@ from __future__ import absolute_import, division, print_function from collections import namedtuple from cryptography import utils -from cryptography.exceptions import UnsupportedAlgorithm, InvalidTag +from cryptography.exceptions import ( + UnsupportedAlgorithm, InvalidTag, InternalError +) from cryptography.hazmat.backends.interfaces import ( HashBackend, HMACBackend, CipherBackend ) @@ -197,8 +199,9 @@ class Backend(object): "the block length" ) else: - raise SystemError( - "The backend returned an error. Code: {0}".format(response) + raise InternalError( + "The backend returned an unknown error, consider filing a bug." + " Code: {0}.".format(response) ) diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index ee82ba71..b5116be4 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -16,7 +16,9 @@ from __future__ import absolute_import, division, print_function import itertools from cryptography import utils -from cryptography.exceptions import UnsupportedAlgorithm, InvalidTag +from cryptography.exceptions import ( + UnsupportedAlgorithm, InvalidTag, InternalError +) from cryptography.hazmat.backends.interfaces import ( CipherBackend, HashBackend, HMACBackend ) @@ -154,7 +156,7 @@ class Backend(object): "the block length" ) - raise SystemError( + raise InternalError( "Unknown error code from OpenSSL, you should probably file a bug." ) |
