File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
1
# CHANGELOG
2
2
3
3
## 0.2.14dev
4
+ * [ Fix] Fix error when using ` @modify_exceptions ` in an exception initialized without arguments
4
5
5
6
## 0.2.13 (2023-06-27)
6
7
Original file line number Diff line number Diff line change @@ -82,7 +82,9 @@ class ValidationError(BaseException):
82
82
83
83
84
84
def _add_community_link (e ):
85
- if COMMUNITY not in e .args [0 ]:
85
+ if not len (e .args ):
86
+ e .args = (COMMUNITY ,)
87
+ elif COMMUNITY not in e .args [0 ]:
86
88
message = e .args [0 ] + COMMUNITY
87
89
e .args = (message ,)
88
90
Original file line number Diff line number Diff line change @@ -65,6 +65,17 @@ def crash():
65
65
assert exceptions .get_community_link () in str (excinfo .value )
66
66
67
67
68
+ def test_modify_exceptions_no_message ():
69
+ @exceptions .modify_exceptions
70
+ def crash ():
71
+ raise ValueError
72
+
73
+ with pytest .raises (ValueError ) as excinfo :
74
+ crash ()
75
+
76
+ assert exceptions .get_community_link () in str (excinfo .value )
77
+
78
+
68
79
def test_modify_exceptions_value_error_method ():
69
80
class Something :
70
81
@exceptions .modify_exceptions
You can’t perform that action at this time.
0 commit comments