-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Description
When connect() fails due to repeated failures, it throws RuntimeError:
Adafruit_CircuitPython_MiniMQTT/adafruit_minimqtt/adafruit_minimqtt.py
Lines 269 to 279 in 67e0ade
| try: | |
| sock.connect((connect_host, port)) | |
| except MemoryError: | |
| sock.close() | |
| sock = None | |
| except OSError: | |
| sock.close() | |
| sock = None | |
| if sock is None: | |
| raise RuntimeError("Repeated socket failures") |
This is not very useful for the caller. Some suggestions:
- rethrow the last exception
- wrap the exceptions raised by
connect()intoRuntimeErrorexception (or maybe used dedicated exception) - add some info about the problem to the
RuntimeErrortext (including how many times it tried)
Metadata
Metadata
Assignees
Labels
No labels