Skip to content

Commit b04f527

Browse files
committed
NPI-4443 slight clean up of exception handling in gn_download.py, to remove a redundant error log
1 parent 67928f1 commit b04f527

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

gnssanalysis/gn_download.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -823,14 +823,8 @@ def download_file_from_cddis(
823823
if download_filepath is None:
824824
return None # File exists and user chose not to replace
825825

826-
# Get NASA Earthdata credentials
827-
try:
828-
earthdata_username, earthdata_password = get_earthdata_credentials(
829-
username=username, password=password
830-
)
831-
except ValueError as e:
832-
logging.error(f"Failed to obtain NASA Earthdata credentials: {e}")
833-
raise
826+
# Get NASA Earthdata credentials (raises ValueError on failure)
827+
earthdata_username, earthdata_password = get_earthdata_credentials(username=username, password=password)
834828

835829
retries = 0
836830
while retries <= max_retries:
@@ -862,6 +856,7 @@ def download_file_from_cddis(
862856
except _requests.exceptions.RequestException as e:
863857
retries += 1
864858
if retries > max_retries:
859+
# TODO consider wrapping the RequestException with this, and raising that, rather than logging an error
865860
logging.error(f"Failed to download {filename} after {max_retries} retries: {e}")
866861
if download_filepath.is_file():
867862
download_filepath.unlink()

0 commit comments

Comments
 (0)