From ee89582a1bccb771bf87ca268a803db5a1b649f5 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 12 Aug 2020 10:28:06 -0700 Subject: [PATCH] Return 404 when channel could not be added and still does not exist. --- frontends/ycdl_flask/backend/endpoints/channel_endpoints.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontends/ycdl_flask/backend/endpoints/channel_endpoints.py b/frontends/ycdl_flask/backend/endpoints/channel_endpoints.py index 500c8f4..9d4f0e4 100644 --- a/frontends/ycdl_flask/backend/endpoints/channel_endpoints.py +++ b/frontends/ycdl_flask/backend/endpoints/channel_endpoints.py @@ -26,7 +26,10 @@ def get_channel(channel_id=None, download_filter=None): common.ycdldb.add_channel(channel_id) except Exception: traceback.print_exc() - channel = common.ycdldb.get_channel(channel_id) + try: + channel = common.ycdldb.get_channel(channel_id) + except ycdl.exceptions.NoSuchChannel: + flask.abort(404) else: channel = None