From 5457ce5ec138429158cdb8f5f415e14ec5e6d4cd Mon Sep 17 00:00:00 2001 From: Will Chen Date: Fri, 12 Apr 2024 22:46:27 -0700 Subject: [PATCH] Make MesopException the parent class of more specific mesop exceptions & expose as public API (#113) --- mesop/__init__.py | 12 ++++++++++++ mesop/exceptions/__init__.py | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mesop/__init__.py b/mesop/__init__.py index 130e13eaa..a206507e5 100644 --- a/mesop/__init__.py +++ b/mesop/__init__.py @@ -111,6 +111,18 @@ from mesop.events import ( InputEvent as InputEvent, ) +from mesop.exceptions import ( + MesopDeveloperException as MesopDeveloperException, +) +from mesop.exceptions import ( + MesopException as MesopException, +) +from mesop.exceptions import ( + MesopInternalException as MesopInternalException, +) +from mesop.exceptions import ( + MesopUserException as MesopUserException, +) from mesop.features import page as page from mesop.key import Key as Key from mesop.pip_package.version import VERSION diff --git a/mesop/exceptions/__init__.py b/mesop/exceptions/__init__.py index 4545ce6ee..29e90d6f3 100644 --- a/mesop/exceptions/__init__.py +++ b/mesop/exceptions/__init__.py @@ -5,16 +5,16 @@ class MesopException(Exception): pass -class MesopUserException(Exception): +class MesopUserException(MesopException): def __str__(self): return f"**User Error:** {super().__str__()}" -class MesopInternalException(Exception): +class MesopInternalException(MesopException): def __str__(self): return f"**Mesop Internal Error:** {super().__str__()}" -class MesopDeveloperException(Exception): +class MesopDeveloperException(MesopException): def __str__(self): return f"**Mesop Developer Error:** {super().__str__()}"