From 86104621edc9758155909e0b6e7b9822190815fc Mon Sep 17 00:00:00 2001 From: mryouse Date: Sun, 5 Jun 2022 03:06:12 +0000 Subject: refactor: better error messages --- exceptions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 exceptions.py (limited to 'exceptions.py') diff --git a/exceptions.py b/exceptions.py new file mode 100644 index 0000000..98395ac --- /dev/null +++ b/exceptions.py @@ -0,0 +1,10 @@ +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" ({arg})" + super().__init__(big_message) + -- cgit v1.2.3