astropy / astropy/pyvo

DalResults does not appropriately handle 404 (or any HTTP error)

Open
#625 3 comments 0 reactions 0 assignees View on GitHub
bug component: dal
Dominant language
Python
Stars
88
Forks
64
Avg merge
38m
Merged PRs (30d)
1

Description

Any calls to DalResult.from_result_url resulting in an error condition (404, 5xx etc) will proceed to trying to parse the response as a votable.

For a user calling a higher-level function like DataLinkResults.from_result_url the resulting error is a parse error deep inside votable and distracts from the actual problem (the service doesn't have what they're looking for).

I've filed an example of this behavior occurring at an LSST data facility [here](https://github.com/rubin-dp0/Support/issues/76). That bug has an [example notebook](https://gist.github.com/mtauraso/6666f1fb5c6d9897779ed5c3563bf179) which is a cut-down version of an LSST tutorial showcasing the bug in action.

The pyvo issue is [here](https://github.com/astropy/pyvo/blob/2bf4e3f1ffea04fa168713a715b0058efed77d6e/pyvo/dal/query.py#L301). Either `from_result_url` or `_from_result_url` should check `.status` on the `HTTPResponse` object returned from [`session.get`](https://github.com/astropy/pyvo/blob/2bf4e3f1ffea04fa168713a715b0058efed77d6e/pyvo/auth/authsession.py#L60) and raise an appropriate exception.

I'm happy to submit a PR if there is support for the fix suggested above.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in pyvo/dal/query.py at DalResult.from_result_url or _from_result_url, and inspect the HTTPResponse returned by session.get in pyvo/auth/authsession.py. Verify how 404 and 5xx responses are handled before VOTable parsing. Done means HTTP errors raise an appropriate exception instead of becoming misleading parse errors in higher-level DataLinkResults.from_result_url calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.