diff --git a/utils/config-generator.py b/utils/config-generator.py index 81e6424af..4d9fb2c1c 100755 --- a/utils/config-generator.py +++ b/utils/config-generator.py @@ -734,7 +734,13 @@ def create_node_snapshot_config_json(history_mode): octez_container_version = os.environ.get("OCTEZ_VERSION") snapshot_source = os.environ.get("SNAPSHOT_SOURCE") if snapshot_source: - all_snapshots = requests.get(snapshot_source).json() + try: + response = requests.get(snapshot_source) + response.raise_for_status() # Raises an HTTPError if the HTTP request returned an unsuccessful status code + all_snapshots = response.json() + except (requests.exceptions.RequestException, requests.exceptions.JSONDecodeError): # Catches exceptions related to requests and invalid JSON + print(f"Error: unable to retrieve snapshot metadata from {snapshot_source}") + return else: return try: