Skip to content

ssl_context.wrap_socket() raises exception without meaningful message #22

@jake1164

Description

@jake1164

In the def _get_connected_socket( method inside the if is_ssl the ssl_context.wrap_socket() call will raise an exception without any message making it difficult for downstream users to identify why they are getting an exception.

Recommend catching exception and raising with a more meaningful message to make it easier for downstream users.
Something along the lines of:

        if is_ssl:
            try:
                socket = ssl_context.wrap_socket(socket, server_hostname=host)
            except Exception as error:
                # if error is null / blank raise exception with a more meaningful message)
                if not str(error):
                    raise RuntimeError("ssl_context could not wrap_socket")
                raise error
            connect_host = host
        else:
            connect_host = addr_info[-1][0]

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