fix(simulation): add FileNotFoundError check in delete_agent_profile and endpoint
This commit is contained in:
parent
83cf890c83
commit
ed71afe442
|
|
@ -2743,6 +2743,8 @@ def delete_agent(simulation_id: str, user_id: int):
|
|||
return jsonify({"success": False, "error": str(e)}), 403
|
||||
except LookupError as e:
|
||||
return jsonify({"success": False, "error": str(e)}), 404
|
||||
except FileNotFoundError as e:
|
||||
return jsonify({"success": False, "error": str(e)}), 404
|
||||
|
||||
return jsonify({"success": True, "data": {"deleted_user_id": user_id}})
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -614,6 +614,9 @@ class SimulationManager:
|
|||
profiles_file = os.path.join(sim_dir, "reddit_profiles.json")
|
||||
backup_file = profiles_file + ".bak"
|
||||
|
||||
if not os.path.exists(profiles_file):
|
||||
raise FileNotFoundError(f"reddit_profiles.json not found for {simulation_id}")
|
||||
|
||||
with open(profiles_file, 'r', encoding='utf-8') as f:
|
||||
profiles = json.load(f)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue