Skip to content

Commit

Permalink
Merge pull request #2131 from iamdefinitelyahuman/fix-interface-excep…
Browse files Browse the repository at this point in the history
…tions

Improve exception on incorrect interface
  • Loading branch information
fubuloubu authored Aug 19, 2020
2 parents 7949850 + b33d394 commit 0879886
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vyper/context/types/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,18 @@ def from_FunctionDef(
# Interfaces are always public
kwargs["function_visibility"] = FunctionVisibility.EXTERNAL
kwargs["state_mutability"] = StateMutability(node.body[0].value.id)
elif len(node.body) == 1 and node.body[0].get("value.id") in ("constant", "modifying"):
if node.body[0].value.id == "constant":
expected = "view or pure"
else:
expected = "payable or nonpayable"
raise StructureException(
f"State mutability should be set to {expected}", node.body[0]
)
else:
raise StructureException("Body must only contain state mutability label", node)
raise StructureException(
"Body must only contain state mutability label", node.body[0]
)

else:

Expand Down

0 comments on commit 0879886

Please sign in to comment.