Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/nsidc/earthaccess into mindeps
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau committed Dec 6, 2023
2 parents b9fdb12 + a465230 commit d0149e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions earthaccess/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ def get(self, limit: int = 2000) -> list:
try:
response.raise_for_status()
except exceptions.HTTPError as ex:
raise RuntimeError(ex.response.text)
if ex.response is not None:
raise RuntimeError(ex.response.text) from ex
else:
raise RuntimeError(str(ex)) from ex

if self._format == "json":
latest = response.json()["feed"]["entry"]
Expand Down Expand Up @@ -333,7 +336,10 @@ def hits(self) -> int:
try:
response.raise_for_status()
except exceptions.HTTPError as ex:
raise RuntimeError(ex.response.text)
if ex.response is not None:
raise RuntimeError(ex.response.text) from ex
else:
raise RuntimeError(str(ex)) from ex

return int(response.headers["CMR-Hits"])

Expand Down Expand Up @@ -561,7 +567,10 @@ def get(self, limit: int = 2000) -> list:
try:
response.raise_for_status()
except exceptions.HTTPError as ex:
raise RuntimeError(ex.response.text)
if ex.response is not None:
raise RuntimeError(ex.response.text) from ex
else:
raise RuntimeError(str(ex)) from ex

if self._format == "json":
latest = response.json()["feed"]["entry"]
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d0149e9

Please sign in to comment.