Skip to content

Commit

Permalink
Merge branch 'master' into feat/metadata-hash
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper authored Sep 17, 2024
2 parents 4e345d6 + 03095ce commit 5dcdbd3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions vyper/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ def hint(self):

@property
def message(self):
msg = self._message
if self.hint:
msg += f"\n\n (hint: {self.hint})"
return msg
return self._message

def format_annotation(self, value):
from vyper import ast as vy_ast
Expand Down Expand Up @@ -148,7 +145,16 @@ def format_annotation(self, value):
node_msg = textwrap.indent(node_msg, " ")
return node_msg

def _add_hint(self, msg):
hint = self.hint
if hint is None:
return msg
return msg + f"\n (hint: {self.hint})"

def __str__(self):
return self._add_hint(self._str_helper())

def _str_helper(self):
if not self.annotations:
if self.lineno is not None and self.col_offset is not None:
return f"line {self.lineno}:{self.col_offset} {self.message}"
Expand Down

0 comments on commit 5dcdbd3

Please sign in to comment.