Skip to content

Commit

Permalink
improved error feedback for wrong path
Browse files Browse the repository at this point in the history
  • Loading branch information
danrgll committed Apr 15, 2024
1 parent 8fe2366 commit 82e3e25
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion neps/search_spaces/search_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ def pipeline_space_from_yaml(
try:
with open(yaml_file_path) as file:
config = yaml.safe_load(file)
except FileNotFoundError as e:
raise FileNotFoundError(
f"Unable to find the specified file for 'pipeline_space' at "
f"'{yaml_file_path}'. Please verify the path specified in the "
f"'pipeline_space' argument and try again."
) from e
except yaml.YAMLError as e:
raise ValueError(
f"The file at {str(yaml_file_path)} is not a valid YAML file."
Expand Down Expand Up @@ -177,7 +183,7 @@ def pipeline_space_from_yaml(
"For categorical parameter: cat, categorical\n"
"For constant parameter: const, constant\n"
)
except (KeyError, TypeError, ValueError) as e:
except (KeyError, TypeError, ValueError, FileNotFoundError) as e:
raise SearchSpaceFromYamlFileError(e) from e
return pipeline_space

Expand Down

0 comments on commit 82e3e25

Please sign in to comment.