Skip to content

Commit

Permalink
better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Feb 25, 2022
1 parent 058a0cf commit 109acfd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/runtime/ltypes/ltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def ltype(x):
return (str, )
elif type(x) == bool:
return (bool, )
raise Exception("Unsupported Type")
raise Exception("Unsupported Type: %s" % str(type(x)))


class OverloadedFunction:
Expand All @@ -44,7 +44,7 @@ def __init__(self, func):
def __call__(self, *args, **kwargs):
func_map_list = self.global_map.get(self.func_name, False)
if not func_map_list:
raise Exception("Function not defined")
raise Exception("Function: %s is not defined" % self.func_name)
for item in func_map_list:
func, key = item
try:
Expand All @@ -63,7 +63,8 @@ def __call__(self, *args, **kwargs):
break
if flag:
return func(*args, **kwargs)
raise Exception("Function not found with matching signature")
raise Exception(f"Function: {self.func_name} not found with matching "
"signature")


def overload(f):
Expand Down

0 comments on commit 109acfd

Please sign in to comment.