Fix activate_project_from_path_or_name incorrectly assuming that argument is a directory,

leading to a misleading exception
This commit is contained in:
Dominik Jain
2025-05-26 23:21:36 +02:00
parent 9bc3b4183e
commit e9801bcc31
+5
View File
@@ -572,6 +572,11 @@ class SerenaAgent:
if project_instance is not None:
log.info(f"Found registered project {project_instance.project_name} at path {project_instance.project_root}.")
else:
if not os.path.isdir(project_root_or_name):
raise ValueError(
f"Project '{project_root_or_name}' not found: Not a valid project name or directory. "
f"Existing project names: {self.serena_config.project_names}"
)
project_instance, new_project_config_generated = self.serena_config.add_project_from_path(
project_root_or_name, update_config_file=True
)