Skip to content

Commit

Permalink
Merge pull request #309 from AstarVienna/fh/downloaderrormsg
Browse files Browse the repository at this point in the history
Add more useful error message to download functions
  • Loading branch information
teutoburg authored Dec 14, 2023
2 parents 1759dae + ebb52a7 commit 89b3872
Showing 1 changed file with 7 additions and 1 deletion.
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 @@ def _download_single_package(pkg_name: str, release: str, all_versions,
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}'?"

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

0 comments on commit 89b3872

Please sign in to comment.