Spaces:
Runtime error
Runtime error
Update customdish.py
Browse files- customdish.py +6 -5
customdish.py
CHANGED
|
@@ -55,11 +55,12 @@ def generate_custom_dish():
|
|
| 55 |
'Ingredients_List__c':'Ingredients List'
|
| 56 |
}
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
| 63 |
|
| 64 |
# After ensuring the dish exists, check if it's already in the Cart_Item__c
|
| 65 |
email = session.get('user_email') # Assuming you have the user's email in session
|
|
|
|
| 55 |
'Ingredients_List__c':'Ingredients List'
|
| 56 |
}
|
| 57 |
|
| 58 |
+
try:
|
| 59 |
+
result = sf.Custom_Dish__c.create(custom_dish)
|
| 60 |
+
if not result.get('success'):
|
| 61 |
+
return jsonify({"success": False, "error": "Failed to create custom dish in Salesforce"}), 500
|
| 62 |
+
except Exception as e:
|
| 63 |
+
return jsonify({"success": False, "error": f"Error creating record: {str(e)}"}), 500
|
| 64 |
|
| 65 |
# After ensuring the dish exists, check if it's already in the Cart_Item__c
|
| 66 |
email = session.get('user_email') # Assuming you have the user's email in session
|