diff options
-rw-r--r-- | gnunet/__init__.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gnunet/__init__.py b/gnunet/__init__.py index c4c5648..5bae6f0 100644 --- a/gnunet/__init__.py +++ b/gnunet/__init__.py | |||
@@ -14,10 +14,12 @@ class _Key: | |||
14 | else: | 14 | else: |
15 | try: | 15 | try: |
16 | self._data = bytearray(arg) | 16 | self._data = bytearray(arg) |
17 | except: | 17 | except TypeError as e: |
18 | raise TypeError("'arg' must be a %s, a string or an array " | 18 | # HACK: replace the exception message |
19 | "of bytes. Not a '%s'." % | 19 | e.args = ("'arg' must be a %s, a string or an array " |
20 | (type(self).__name__, type(arg).__name__),) | 20 | "of bytes. Not a '%s'." % |
21 | (type(self).__name__, type(arg).__name__),) | ||
22 | raise | ||
21 | 23 | ||
22 | if len(self._data) * 8 != self.__bits__: | 24 | if len(self._data) * 8 != self.__bits__: |
23 | raise ValueError("'arg' must be a %s bit hash. Got %s bits." | 25 | raise ValueError("'arg' must be a %s bit hash. Got %s bits." |