Skip to content

Commit

Permalink
add try block to return useful error message for failed download
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Barrett committed Jul 21, 2023
1 parent c173121 commit 34d884c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion earthaccess/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ def download(
Returns:
List of downloaded files
"""
results = earthaccess.__store__.get(granules, local_path, provider, threads)
try:
results = earthaccess.__store__.get(granules, local_path, provider, threads)
except AttributeError as err:
print(err)
print("You must call earthaccess.login() before you can download data")
return None

return results


Expand Down

0 comments on commit 34d884c

Please sign in to comment.