fix[tool]: add missing user errors to error map #4286
fix[tool]: add missing user errors to error map #4286charles-cooper merged 21 commits intovyperlang:masterfrom
Conversation
| raise "some error" | ||
| """ | ||
| error_map = compile_code(code, output_formats=["source_map"])["source_map"]["error_map"] | ||
| assert "user revert with reason" in list(error_map.values()) |
There was a problem hiding this comment.
why can't we check in error_map.values()?
There was a problem hiding this comment.
We can. test_error_map also wraps the values in list - should I change it there too?
There was a problem hiding this comment.
it's a dict view, i think we should. @charles-cooper do you remember the reason you did it this way?
There was a problem hiding this comment.
it's a dict view, i think we should. @charles-cooper do you remember the reason you did it this way?
no, just habit i think
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4286 +/- ##
===========================================
- Coverage 91.27% 45.57% -45.71%
===========================================
Files 112 112
Lines 16017 16017
Branches 2696 2696
===========================================
- Hits 14619 7299 -7320
- Misses 966 8159 +7193
- Partials 432 559 +127 ☔ View full report in Codecov by Sentry. |
charles-cooper
left a comment
There was a problem hiding this comment.
As discussed offline- please check if it is feasible to call set_error_msg in the from_list factory
vyper/codegen/ir_node.py
Outdated
| passthrough_metadata=passthrough_metadata, | ||
| ) | ||
| if error_msg is not None: | ||
| ret.set_error_msg(error_msg) |
There was a problem hiding this comment.
maybe _set_error_msg, since the IRnode may already have error_msg set
|
i think the PR addresses the issue but we're still overriding error messages for less concrete ones in following will fail def test_error_map_with_user_error2():
code = """
@external
def foo(i: uint256):
a: DynArray[uint256, 10] = [1]
a[i % 10] = 2
"""
error_map = compile_code(code, output_formats=["source_map"])["source_map"]["error_map"]
assert "safemod" in error_map.values()as it will get overwritten by |
this is a good catch. @sandbubbles can you add the guard to |
Done:), should be ready for another check. |
|
@sandbubbles please write out a commit message for this pull request :) |
What I did
Fix #4199
How I did it
Moved error message to "revert"
How to verify it
Commit message
Description for the changelog
Cute Animal Picture
Edit: commit msg