geethareddy commited on
Commit
abf4eb1
·
verified ·
1 Parent(s): 3744f4f

Update customdish.py

Browse files
Files changed (1) hide show
  1. customdish.py +6 -5
customdish.py CHANGED
@@ -55,11 +55,12 @@ def generate_custom_dish():
55
  'Ingredients_List__c':'Ingredients List'
56
  }
57
 
58
- # Insert the custom dish into Salesforce (Custom_Dish__c object)
59
- result = sf.Custom_Dish__c.create(custom_dish)
60
-
61
- if not result.get('success'):
62
- return jsonify({"success": False, "error": "Failed to create custom dish in Salesforce"}), 500
 
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