From b2c874b4a62916ddabc1d8e9c269ee96c50746c4 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 4 Sep 2022 21:03:17 +0200 Subject: [PATCH] Return 404 on missing timeseries --- app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 90a596a..f6e6d0e 100644 --- a/app.py +++ b/app.py @@ -38,7 +38,10 @@ def report(): @app.route("/ts/") def get_timeseries(id): - ts = LTS(id=id) + try: + ts = LTS(id=id) + except FileNotFoundError: + abort(404) return jsonify({"description": ts.description, "data": ts.data}) def verify_node(d):