From f2c29f4073dcb8862ac482e3493e962e8787e5f5 Mon Sep 17 00:00:00 2001
From: Nathan Woodburn <github@nathan.woodburn.au>
Date: Thu, 6 Mar 2025 15:24:11 +1100
Subject: [PATCH] fix: Add error message for invalid tz

---
 server.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server.py b/server.py
index 0e3148e..b28738d 100644
--- a/server.py
+++ b/server.py
@@ -126,7 +126,10 @@ def get_full_timezone(tz):
         minutes = int(match.group(2)) if match.group(2) else 0
         return pytz.FixedOffset(hours * 60 + minutes)
     full_tz = SHORT_TZ_MAP.get(tz, tz)
-    return pytz.timezone(full_tz) if isinstance(full_tz, str) else None
+    try:
+        return pytz.timezone(full_tz) if isinstance(full_tz, str) else None
+    except pytz.UnknownTimeZoneError:
+        return None
 
 @app.route("/api/v1/convert", methods=["POST"])
 def convert():