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)