Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more useful error message to download functions #309

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scopesim/server/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,14 @@
folder_dict: Path, base_url: str, save_dir: Path,
padlen: int, from_cache: bool) -> Path:
if pkg_name not in all_versions:
maybe = ""
for key in folder_dict:
if pkg_name in key or key in pkg_name:
maybe = f"\nDid you mean '{key}' instead of '{pkg_name}'?"

Check warning on line 337 in scopesim/server/database.py

View check run for this annotation

Codecov / codecov/patch

scopesim/server/database.py#L334-L337

Added lines #L334 - L337 were not covered by tests

raise PkgNotFoundError(f"Unable to find {release} release for "
f"package '{pkg_name}' on server {base_url}.")
f"package '{pkg_name}' on server {base_url}."
+ maybe)

if save_dir is None:
save_dir = rc.__config__["!SIM.file.local_packages_path"]
Expand Down