From 2cd4fcfd88769b2ecfc1f1384983fef41c2f0203 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 15 Nov 2017 16:04:35 -0800 Subject: [PATCH] Add error message for offset/limit type errors --- src/pylorax/api/v0.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pylorax/api/v0.py b/src/pylorax/api/v0.py index 8d790a8d..024309a1 100644 --- a/src/pylorax/api/v0.py +++ b/src/pylorax/api/v0.py @@ -62,9 +62,8 @@ def v0_api(api): try: limit = int(request.args.get("limit", "20")) offset = int(request.args.get("offset", "0")) - except ValueError: - # TODO return an error - pass + except ValueError as e: + return jsonify(error={"msg":str(e)}), 400 with api.config["GITLOCK"].lock: recipes = map(lambda f: f[:-5], list_branch_files(api.config["GITLOCK"].repo, "master")) @@ -127,9 +126,8 @@ def v0_api(api): try: limit = int(request.args.get("limit", "20")) offset = int(request.args.get("offset", "0")) - except ValueError: - # TODO return an error - pass + except ValueError as e: + return jsonify(error={"msg":str(e)}), 400 recipes = [] errors = []