Spaces:
Runtime error
Runtime error
Update routes/recommend.py
Browse files- routes/recommend.py +5 -1
routes/recommend.py
CHANGED
|
@@ -315,4 +315,8 @@ def recommend_book():
|
|
| 315 |
except requests.exceptions.Timeout:
|
| 316 |
return jsonify({"error": f"{rec_type} service timeout"}), 504
|
| 317 |
except requests.exceptions.RequestException as e:
|
| 318 |
-
return jsonify({"error": f"Failed to connect to {rec_type} service", "details": str(e)}), 503
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
except requests.exceptions.Timeout:
|
| 316 |
return jsonify({"error": f"{rec_type} service timeout"}), 504
|
| 317 |
except requests.exceptions.RequestException as e:
|
| 318 |
+
return jsonify({"error": f"Failed to connect to {rec_type} service", "details": str(e)}), 503
|
| 319 |
+
|
| 320 |
+
except Exception as e:
|
| 321 |
+
print(f"Recommend error: {e}")
|
| 322 |
+
return jsonify({"error": "Internal server error"}), 500
|