[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-python] 04/12: Avoid "During handling of the above exception" wh
From: |
gnunet |
Subject: |
[gnunet-python] 04/12: Avoid "During handling of the above exception" when re-raising. |
Date: |
Sun, 12 Apr 2020 23:22:22 +0200 |
This is an automated email from the git hooks/post-receive script.
htgoebel pushed a commit to branch master
in repository gnunet-python.
commit 602cde1ebff40544c66ae769426825b5fc400167
Author: Hartmut Goebel <address@hidden>
AuthorDate: Sat Jan 19 19:53:29 2019 +0100
Avoid "During handling of the above exception" when re-raising.
---
gnunet/__init__.py | 10 ++++++----
1 file 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:
else:
try:
self._data = bytearray(arg)
- except:
- raise TypeError("'arg' must be a %s, a string or an array "
- "of bytes. Not a '%s'." %
- (type(self).__name__, type(arg).__name__),)
+ except TypeError as e:
+ # HACK: replace the exception message
+ e.args = ("'arg' must be a %s, a string or an array "
+ "of bytes. Not a '%s'." %
+ (type(self).__name__, type(arg).__name__),)
+ raise
if len(self._data) * 8 != self.__bits__:
raise ValueError("'arg' must be a %s bit hash. Got %s bits."
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnunet-python] branch master updated (bda184f -> a3707a2), gnunet, 2020/04/12
- [gnunet-python] 01/12: Add a small test-suite., gnunet, 2020/04/12
- [gnunet-python] 04/12: Avoid "During handling of the above exception" when re-raising.,
gnunet <=
- [gnunet-python] 02/12: Extend .gitignore., gnunet, 2020/04/12
- [gnunet-python] 03/12: Simplify initiation of `_Key` and subclasses., gnunet, 2020/04/12
- [gnunet-python] 07/12: Add test-cases for strings.string_to_absolute_time., gnunet, 2020/04/12
- [gnunet-python] 06/12: Use relative imports., gnunet, 2020/04/12
- [gnunet-python] 05/12: Add '_Key.__repr__()' to eliminate redundant code in subclasses., gnunet, 2020/04/12
- [gnunet-python] 08/12: Replace spaghetti code by loops., gnunet, 2020/04/12
- [gnunet-python] 09/12: Add test-cases for strings.data_to_string and string_to_data., gnunet, 2020/04/12
- [gnunet-python] 10/12: Mark strings.encTable as private., gnunet, 2020/04/12
- [gnunet-python] 11/12: Use upper-case names for global constant values., gnunet, 2020/04/12
- [gnunet-python] 12/12: Break some very long lines and some other minor code-cleanup., gnunet, 2020/04/12