Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bubble up exception in validators.resolve_from_url #622

Closed
podosinovik opened this issue Sep 8, 2021 · 3 comments · Fixed by #1263
Closed

Bubble up exception in validators.resolve_from_url #622

podosinovik opened this issue Sep 8, 2021 · 3 comments · Fixed by #1263
Assignees
Milestone

Comments

@podosinovik
Copy link

So that I don't bury the (causal but not related) lead, the geojson.org schemas are unreachable (e.g. https://geojson.org/schema/Feature.json).

I discovered this when validating a pystac Item (pystac 1.1.0). The exception that I correctly saw was:

File ".../python3.9/site-packages/jsonschema/validators.py", line 779, in resolve_from_url
    raise exceptions.RefResolutionError(exc)
jsonschema.exceptions.RefResolutionError: HTTP Error 404: Not Found

However, the specific URL is nowhere to be found in the exception. It would be really useful to have this information bubbled up in exc so that the developer doesn't have to go digging through the debug stack.

Thanks!

@podosinovik
Copy link
Author

The schema issue has already been captured in the geojson repo: geojson/schema#29

@gadomski gadomski added this to the 1.7 milestone Jan 31, 2023
@gadomski gadomski self-assigned this Feb 22, 2023
@gadomski
Copy link
Member

gadomski commented Feb 22, 2023

If requests is present on the system, jsonschema doesn't propagate the problematic URL. I've opened python-jsonschema/jsonschema#1050 to fix, and consider that a blocker to fixing this issue. I've got a WIP branch that has some test infrastructure we can use once/if jsonschema is updated: https://github.com/stac-utils/pystac/tree/issues/622-better-exceptions.

I'm moving this back to the 1.8 milestone since I don't know how long it'll be before we'll get an upstream fix.

@gadomski gadomski modified the milestones: 1.7, 1.8 Feb 22, 2023
@gadomski
Copy link
Member

Well, looks like jsonschema is going through a major overhaul: python-jsonschema/jsonschema#1050 (comment). All the more reason to hold off on any changes/fixes until that lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

3 participants