Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Connection Manager get_socket() will return exception without message #206

@jake1164

Description

@jake1164

In def request() line 633 I am getting an exception thrown at
socket = self._connection_manager.get_socket(
however there is no message with the exception making it difficult to know why its failing.

This is on a Pico W and most likely due to an API call that is too large my best guess and so I would recommend adding a try and when the exception is thrown checking if the message is blank and adding one to the throw so the call to the request knows where it failed.

Something along the lines of

        while retry_count < 2:
            retry_count += 1
            try:
                socket = self._connection_manager.get_socket(
                    host,
                    port,
                    proto,
                    session_id=self._session_id,
                    timeout=timeout,
                    ssl_context=self._ssl_context,
                )
            except Exception as exc:
                print('connection_manager.get_socket',exc)
                # raise exception but add message if its empty
                if not str(exc):
                    raise RuntimeError("Failed to get socket") from exc
                ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions