1
0
Fork 0
mirror of https://github.com/cosmo-sims/cosmICweb-music.git synced 2024-09-19 16:53:43 +02:00

better error logging

This commit is contained in:
Lukas Winkler 2024-04-17 18:40:05 +02:00
parent dd477197a4
commit 24028afc06
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -91,6 +91,7 @@ def fetch_ellipsoids(url, api_token, attempts):
r.raise_for_status()
except requests.exceptions.HTTPError as e:
logging.warning("Failed fetching (attempt {}/{}) ...".format(i, attempts))
logging.warning(e)
else:
content = r.json()
return [
@ -121,8 +122,9 @@ def fetch_downloadstore(cosmicweb_url, target):
# This will raise an error if not successful
r.raise_for_status()
except requests.exceptions.HTTPError as e:
logging.critical("Failed downloading from cosmICweb.")
sys.exit("Error")
logging.critical(f"Failed downloading from cosmICweb.")
logging.critical(e)
sys.exit(1)
content = r.json()
sim = content["simulation"]
halo_urls = [
@ -150,7 +152,8 @@ def fetch_publication(cosmicweb_url, publication_name, traceback_radius):
r.raise_for_status()
except requests.exceptions.HTTPError as e:
logging.critical("Failed downloading from cosmICweb.")
sys.exit("Error")
logging.critical(e)
sys.exit(1)
content = r.json()
sim = content["simulation"]
halo_names = [h["name"] for h in content["halos"]]