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

Include error from backend service when searching with invalid params #1393

Open
amarandon opened this issue Nov 8, 2024 · 0 comments
Open
Labels
bug Something isn't working dedl DEDL related

Comments

@amarandon
Copy link
Collaborator

Example

from eodag import EODataAccessGateway

dag = EODataAccessGateway()
dag.set_preferred_provider("dedl")

search_criteria = {
        "productType": "CAMS_EAC4",
        "start": "2024-09-01",
        "end": "2024-08-01",  # *** BEFORE START DATE ***
        "geom": {"lonmin": 1, "latmin": 43, "lonmax": 2, "latmax": 44},
        "count": True,
        "provider": "dedl",
        "raise_errors": True,
}

dag.search(**search_criteria)

When running this code, a RequestError gets raised:

[...]
eodag.utils.exceptions.RequestError: ('Skipping error while searching for dedl StacSearch instance', 
'400 Client Error: Bad Request for url: https://hda.data.destination-earth.eu/stac/search')

However this is missing details returned by the backend services.

If we run the same code with increased logging:

from eodag import EODataAccessGateway, setup_logging
setup_logging(3)

dag = EODataAccessGateway()

dag.set_preferred_provider("dedl")

search_criteria = {
        "productType": "CAMS_EAC4",
        "start": "2024-09-01",
        "end": "2024-08-01",  # *** BEFORE START DATE ***
        "geom": {"lonmin": 1, "latmin": 43, "lonmax": 2, "latmax": 44},
        "count": True,
        "provider": "dedl",
        "raise_errors": True,
}

dag.search(**search_criteria)

Then we can see useful details being logged:

[...]
2024-10-08 15:31:26,929 eodag.search.qssearch            [DEBUG   ] b'{"description":"1 error(s). datetime: Value error, Invalid datetime range, must match format (begin_date, end_date)"}'
[...]

This info should be included in the exception text.

@amarandon amarandon added bug Something isn't working dedl DEDL related labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dedl DEDL related
Projects
None yet
Development

No branches or pull requests

1 participant