Added some error logging
This commit is contained in:
@@ -54,6 +54,7 @@ def hello_world():
|
||||
|
||||
@app.route("/cooking-params", methods=["POST"])
|
||||
async def cooking_params():
|
||||
try:
|
||||
data = request.get_json()
|
||||
|
||||
if not data:
|
||||
@@ -78,6 +79,7 @@ async def cooking_params():
|
||||
f.write(base64.b64decode(camera_image_b64))
|
||||
data["camera_image"] = filepath
|
||||
except Exception as e:
|
||||
print(f"[Error] Failed to save camera image: {str(e)}")
|
||||
return jsonify({"error": f"Failed to save camera image: {str(e)}"}), 500
|
||||
|
||||
# 2. Run Vision Safety Check & Cook Planner Concurrently
|
||||
@@ -96,6 +98,7 @@ async def cooking_params():
|
||||
safety_result, cook_plan = await asyncio.gather(safety_task, planner_task)
|
||||
|
||||
except Exception as e:
|
||||
print(f"[Error] Exception during safety check or cook planning: {str(e)}")
|
||||
return jsonify({"error": f"Task execution failed: {str(e)}"}), 500
|
||||
|
||||
# 3. Evaluate Safety Result
|
||||
@@ -119,6 +122,8 @@ async def cooking_params():
|
||||
return jsonify({"error": f"Database error: {str(e)}"}), 500
|
||||
|
||||
return jsonify(cook_plan), 201
|
||||
except Exception as e:
|
||||
print(f"[Error] Exception in /cooking-params: {str(e)}")
|
||||
|
||||
@app.route("/telemetry", methods=["POST"])
|
||||
def telemetry():
|
||||
|
||||
Reference in New Issue
Block a user