Skip to content

Commit 686d430

Browse files
committed
Changes from comments on #3300; add newsfragment
1 parent 8bd23de commit 686d430

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

newsfragments/3300.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use in-house exception wrappers for common Python exceptions, such as ``ValueError``, ``TypeError``, ``AttributeError``, and ``AssertionError``, for better control over exception handling.

tests/library_wide_test.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ def test_no_default_exceptions_are_raised_within_web3py():
1818
if file.endswith(".py"):
1919
file_path = os.path.join(root, file)
2020
with open(file_path, "r", encoding="utf-8") as f:
21-
line_number = 0
22-
for line in f:
23-
line_number += 1
21+
for idx, line in enumerate(f):
2422
for exception in DEFAULT_EXCEPTIONS:
2523
exception_name = exception.__name__
2624
if f"raise {exception_name}" in line:
2725
raise Exception(
28-
f"{exception_name} raised in web3.py. "
26+
f"``{exception_name}`` raised in web3.py. "
2927
f"Replace with ``Web3{exception_name}``:\n"
3028
f" file_path:{file_path}\n"
31-
f" line:{line_number}"
29+
f" line:{idx + 1}"
3230
)

0 commit comments

Comments
 (0)