Fix a couple of error responses

Errors should always be "error:{"msg":"message"}
This commit is contained in:
Brian C. Lane 2018-03-22 16:13:59 -07:00
parent c58e1994e9
commit 2481c486a5

View File

@ -1473,7 +1473,7 @@ def v0_api(api):
try:
uuid_cancel(api.config["COMPOSER_CFG"], uuid)
except Exception as e:
return jsonify(status=False, uuid=uuid, msg=str(e))
return jsonify(status=False, uuid=uuid, error={"msg":str(e)}),400
else:
return jsonify(status=True, uuid=uuid)
@ -1505,7 +1505,7 @@ def v0_api(api):
try:
info = uuid_info(api.config["COMPOSER_CFG"], uuid)
except Exception as e:
return jsonify(status=False, msg=str(e))
return jsonify(status=False, error={"msg":str(e)}), 400
return jsonify(**info)
@ -1588,8 +1588,8 @@ def v0_api(api):
if status is None:
return jsonify(status=False, error={"msg":"%s is not a valid build uuid" % uuid}), 400
elif status["queue_status"] == "WAITING":
return jsonify(status=False, uuid=uuid, msg="Build has not started yet. No logs to view")
return jsonify(status=False, uuid=uuid, error={"msg":"Build has not started yet. No logs to view"})
try:
return Response(uuid_log(api.config["COMPOSER_CFG"], uuid, size), direct_passthrough=True)
except RuntimeError as e:
return jsonify(status=False, uuid=uuid, msg=str(e))
return jsonify(status=False, uuid=uuid, error={"msg":str(e)}), 400