Add error message for offset/limit type errors

This commit is contained in:
Brian C. Lane 2017-11-15 16:04:35 -08:00
parent 9ca9bfe46f
commit 2cd4fcfd88
1 changed files with 4 additions and 6 deletions

View File

@ -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 = []