Description
DatalinkRecordMixin.getdataset() catches any failure in the DataLink path and falls back to the base Record.getdataset():
|
@stream_decode_content |
|
def getdataset(self, timeout=None): |
|
try: |
|
url = next(self.getdatalink().bysemantics('#this')).access_url |
|
response = self._session.get(url, stream=True, timeout=timeout) |
|
try: |
|
response.raise_for_status() |
|
except requests.RequestException as ex: |
|
raise DALServiceError.from_except(ex, url) |
|
return response.raw |
|
except (DALServiceError, ValueError, StopIteration): |
|
# this should go to Record.getdataset() |
|
return super().getdataset(timeout=timeout) |
The fallback fetches the record's access.reference column without checking the access_format, which may cause confusion for services that follow the Datalink-indirection model where access_url points at a DataLink links endpoint insstead of the data product directly.
So in this scenario, if the first request fails the fallback will fetch the links endpoint and return the VOTable as the dataset, and the user doesn't get any error messages they could otherwise use to discover what went wrong.
Also, note that this path reads .access_url directly instead of getdataurl() which will make error rows lead to a misleading error.
I think we need to fix this by:
- Skip the fallback when the record's access_format indicates a DataLink document
- Propagate the error_message from a DataLink error row instead of swallowing it?
If this seems reasonable and I'm not missing something I'm happy to put in a PR
Description
DatalinkRecordMixin.getdataset()catches any failure in the DataLink path and falls back to the baseRecord.getdataset():pyvo/pyvo/dal/adhoc.py
Lines 435 to 447 in a7c6e6c
The fallback fetches the record's
access.referencecolumn without checking theaccess_format, which may cause confusion for services that follow the Datalink-indirection model whereaccess_urlpoints at a DataLink links endpoint insstead of the data product directly.So in this scenario, if the first request fails the fallback will fetch the links endpoint and return the VOTable as the dataset, and the user doesn't get any error messages they could otherwise use to discover what went wrong.
Also, note that this path reads
.access_urldirectly instead ofgetdataurl()which will make error rows lead to a misleading error.I think we need to fix this by:
If this seems reasonable and I'm not missing something I'm happy to put in a PR