Improve errors
This commit is contained in:
11
Error.py
11
Error.py
@@ -1,2 +1,9 @@
|
||||
class ParseError(Exception):
|
||||
pass
|
||||
class SyntaxException(Exception):
|
||||
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}"
|
||||
|
||||
class RuntimeException(Exception):
|
||||
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