aboutsummaryrefslogtreecommitdiff
path: root/neb/exceptions.py
blob: 8bbe000677de8ff6d43a570cdc22eeca524bb523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
class NebPanic(BaseException):
    pass

class InterpretPanic(NebPanic):
    def __init__(self, sym, msg, arg=None):
        big_message = f"[{sym.line}] '{sym.name}': {msg}"
        if arg is not None:
            big_message += f" (got {arg})"
        super().__init__(big_message)

class LexError(NebPanic):
    def __init__(self, message, line):
        super().__init__(f"line {line}: {message}")