-
-
Notifications
You must be signed in to change notification settings - Fork 836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix[ux]: add missing filename to syntax exceptions #4343
Changes from 11 commits
4425feb
3316865
90723e1
bdf5a42
363cf1d
241511b
b3c8ef5
02c5765
548d583
67dcfb8
2dded1a
2dfa033
5637913
b6591b4
9450428
97b3abe
1b0e02a
05e24d6
5101a27
7f44b10
88174e7
e66da98
bf3ee5b
bd0d2d3
b6adc0b
43edf77
96bac14
af391a6
c09dc65
6ca0cbb
fd8d78d
78362e6
5ea4e2c
5022cfd
7f0b3f4
531cdca
8e87405
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ def __init__(self, message="Error Message not found.", *items, hint=None, prev_d | |
self.lineno = None | ||
self.col_offset = None | ||
self.annotations = None | ||
self.path = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for clarity, let's rename this to |
||
|
||
if len(items) == 1 and isinstance(items[0], tuple) and isinstance(items[0][0], int): | ||
# support older exceptions that don't annotate - remove this in the future! | ||
|
@@ -134,6 +135,9 @@ def format_annotation(self, value): | |
if fn_node: | ||
node_msg = f'{node_msg}function "{fn_node.name}", ' | ||
|
||
if self.path is not None: | ||
node_msg = f'{node_msg}contract "{self.path}", ' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. code smell that this code is similar with line 132 above -- and in fact, line 132 appends lineno but this does not. also the path could be appended twice in case there is both a node and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it better now? |
||
|
||
col_offset_str = "" if node.col_offset is None else str(node.col_offset) | ||
node_msg = f"{node_msg}line {node.lineno}:{col_offset_str} \n{source_annotation}\n" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just checked natspec.py and don't see that it throws
SyntaxException
anywhere?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm -- NatspecSyntaxException inherits from SyntaxException. however it will be better to have the try/catch in
parse_natspec
itself (in case it's ever used from somewhere else)