Skip to content

Commit 7d0838d

Browse files
committed
More warning message edits
1 parent 0738f53 commit 7d0838d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

astroquery/mast/cloud.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def get_cloud_uri(self, data_product, include_bucket=True, full_url=False):
148148

149149
# Making sure we got at least 1 URI from the query above.
150150
if not uri_list or uri_list[0] is None:
151-
warnings.warn('Unable to locate file {}.'.format(data_product[0]), NoResultsWarning)
151+
return
152152
else:
153153
# Output from ``get_cloud_uri_list`` is always a list even when it's only 1 URI
154154
return uri_list[0]
@@ -200,7 +200,7 @@ def get_cloud_uri_list(self, data_products, *, include_bucket=True, full_url=Fal
200200
if e.response['Error']['Code'] != "404":
201201
raise
202202
if verbose:
203-
warnings.warn("Unable to locate file {}.".format(path), NoResultsWarning)
203+
warnings.warn(f"Failed to retrieve cloud path for {path}", NoResultsWarning)
204204
uri_list.append(None)
205205

206206
return uri_list

astroquery/mast/tests/test_mast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ def test_observations_get_cloud_uris_error(mock_client, patch_post):
11661166
exc = ClientError({'Error': {'Code': '404', 'Message': 'Not Found'}}, 'HeadObject')
11671167
mock_client.return_value.head_object.side_effect = exc
11681168

1169-
with pytest.warns(NoResultsWarning, match='Unable to locate file'):
1169+
with pytest.warns(NoResultsWarning, match='Failed to retrieve cloud path'):
11701170
uris = mast.Observations.get_cloud_uris(['mast:HST/product/u9o40504m_c3m.fits'])
11711171
assert uris == []
11721172

0 commit comments

Comments
 (0)