From 2467612e4299ef265a9434673bd209c1459543b9 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Mon, 4 Dec 2023 16:18:55 +0800 Subject: [PATCH] Fix error handling --- gitea-to-ics.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gitea-to-ics.py b/gitea-to-ics.py index 355249e..3a7dfa5 100644 --- a/gitea-to-ics.py +++ b/gitea-to-ics.py @@ -51,10 +51,8 @@ def process_combined(combined): def get_token(input_token): token = input_token.lstrip("Basic ") token = b64decode(token).decode('utf8', 'ignore') - try: + with cherrypy.HTTPError.handle(ValueError, 401): _, token = token.split(":", 2) - except ValueError: - raise cherrypy.HTTPError(401, 'Unauthorized') return token class Root: