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

Exception from requests not caught #288

Open
gg3nx opened this issue Sep 13, 2023 · 0 comments
Open

Exception from requests not caught #288

gg3nx opened this issue Sep 13, 2023 · 0 comments
Assignees
Labels
bug Something isn't working priority:medium Improvements that are not the main priority

Comments

@gg3nx
Copy link

gg3nx commented Sep 13, 2023

Got a requests.exceptions.ConnectionError exception when using list_servers_all:

  File "/app/.venv/lib/python3.11/site-packages/scaleway/instance/v1/api.py", line 441, in list_servers_all
    return fetch_all_pages(
           ^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/scaleway_core/utils/fetch_all_pages.py", line 47, in fetch_all_pages
    return items + fetch_all_pages(
                   ^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/scaleway_core/utils/fetch_all_pages.py", line 35, in fetch_all_pages
    data = fetcher(**fetcher_args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/scaleway/instance/v1/api.py", line 373, in list_servers
    res = self._request(
          ^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/scaleway_core/api.py", line 154, in _request
    response = requests.request(
               ^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.scaleway.com', port=443): Max retries exceeded with url: /instance/v1/zones/fr-par-2/servers?page=2&tags=XXX%2CYYY (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fabc202ac10>: Failed to resolve 'api.scaleway.com' ([Errno -3] Try again)"))

The error should have been caught by the SDK which should have raised a ScalewayException to be caught by the caller.

@remyleone remyleone added the bug Something isn't working label Nov 2, 2023
@remyleone remyleone added the priority:medium Improvements that are not the main priority label Dec 11, 2023
@remyleone remyleone assigned Laure-di and unassigned Codelax Apr 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 priority:medium Improvements that are not the main priority
Projects
None yet
Development

No branches or pull requests

4 participants