Improve support for functions #2
This commit is contained in:
2
smnp/error/base.py
Normal file
2
smnp/error/base.py
Normal file
@@ -0,0 +1,2 @@
|
||||
class SmnpException(Exception):
|
||||
pass
|
||||
6
smnp/error/function.py
Normal file
6
smnp/error/function.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from smnp.error.base import SmnpException
|
||||
|
||||
|
||||
class IllegalFunctionInvocationException(SmnpException):
|
||||
def __init__(self, expected, found):
|
||||
self.msg = f"Illegal function invocation\n\nExpected signature:\n{expected}\n\nFound:\n{found}"
|
||||
@@ -1,4 +1,7 @@
|
||||
class RuntimeException(Exception):
|
||||
from smnp.error.base import SmnpException
|
||||
|
||||
|
||||
class RuntimeException(SmnpException):
|
||||
def __init__(self, pos, msg):
|
||||
posStr = "" if pos is None else f" [line {pos[0]+1}, col {pos[1]+1}]"
|
||||
self.msg = f"Runtime error{posStr}:\n{msg}"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
class SyntaxException(Exception):
|
||||
from smnp.error.base import SmnpException
|
||||
|
||||
|
||||
class SyntaxException(SmnpException):
|
||||
def __init__(self, pos, msg):
|
||||
posStr = "" if pos is None else f" [line {pos[0]+1}, col {pos[1]+1}]"
|
||||
self.msg = f"Syntax error{posStr}:\n{msg}"
|
||||
|
||||
Reference in New Issue
Block a user