From 91750395b5047dfb99f5d9b7b49d336b2bfb38e8 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 4 Sep 2025 16:23:17 -0400 Subject: Refactor Admin and Database path stuff Moved the Admin related stuff to a separate file. Removed the repetitive `db_path` arg everywhere and replaced it with correct assumptions, similar to whats in other apps. --- Omni/App.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Omni') diff --git a/Omni/App.py b/Omni/App.py index 0c6776c..d42bb75 100644 --- a/Omni/App.py +++ b/Omni/App.py @@ -4,6 +4,10 @@ import enum import os +class AreaError(Exception): + """Error raised when area configuration is invalid or missing.""" + + class Area(enum.Enum): """The area we are running.""" @@ -15,7 +19,7 @@ def from_env() -> Area: """Load AREA from environment variable. Raises: - ValueError: if AREA is not defined + AreaError: if AREA is not defined """ var = os.getenv("AREA", "Test") if var == "Test": @@ -23,4 +27,4 @@ def from_env() -> Area: if var == "Live": return Area.Live msg = "AREA not defined" - raise ValueError(msg) + raise AreaError(msg) -- cgit v1.2.3