Skip to content

Add contract name to exceptions#2103

Merged
iamdefinitelyahuman merged 4 commits into
vyperlang:masterfrom
iamdefinitelyahuman:feat-contract-name
Jul 6, 2020
Merged

Add contract name to exceptions#2103
iamdefinitelyahuman merged 4 commits into
vyperlang:masterfrom
iamdefinitelyahuman:feat-contract-name

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

  • Display the name of the active contract when raising an exception. This is useful when an exception occurs while parsing an interface.
  • Ensure the correct annotation shows when parsing interfaces.

How I did it

  • Add a name field to the Module AST node. This gets added via a new kwarg for parse_to_ast
  • Include the contract_name kwarg when generating ASTs in compiler and signatures

How to verify it

Cause an exception. It should give output like this:

UnknownType: Not a valid type - value is undeclared
contract "cERC20", function "transfer", line 21:18 
     20 @external
---> 21 def transfer(_to: oopsie, _value: uint256) -> bool:
--------------------------^
     22     pass

Cute Animal Picture

image

@iamdefinitelyahuman iamdefinitelyahuman merged commit e4dfbbf into vyperlang:master Jul 6, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the feat-contract-name branch July 6, 2020 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants