adafruit / adafruit/Adafruit_CircuitPython_ConnectionManager

ssl_context.wrap_socket() raises exception without meaningful message

Open
#22 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6
Forks
5
PR merge metrics
No merged PRs in 30d

Description

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]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.