Skip to content

Commit 137b570

Browse files
authored
Merge pull request adafruit#49 from askpatrickw/patch-1
Adafruit Logging is required
2 parents 74eca06 + 8d45540 commit 137b570

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

README.rst

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Dependencies
2020
This driver depends on:
2121

2222
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
23+
* `Adafruit Logging <https://github.com/adafruit/Adafruit_CircuitPython_Logging>`_
2324

2425
Please ensure all dependencies are available on the CircuitPython filesystem.
2526
This is easily achieved by downloading

adafruit_minimqtt/adafruit_minimqtt.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ def remove_topic_callback(self, mqtt_topic):
246246
try:
247247
del self._on_message_filtered[mqtt_topic]
248248
except KeyError:
249-
raise KeyError("MQTT topic callback not added with add_topic_callback.")
249+
raise KeyError(
250+
"MQTT topic callback not added with add_topic_callback."
251+
) from None
250252

251253
@property
252254
def on_message(self):
@@ -287,7 +289,7 @@ def connect(self, clean_session=True):
287289
conntype = _the_interface.TLS_MODE
288290
self._sock.connect((self.broker, self.port), conntype)
289291
except RuntimeError as e:
290-
raise MMQTTException("Invalid broker address defined.", e)
292+
raise MMQTTException("Invalid broker address defined.", e) from None
291293
else:
292294
try:
293295
if self.logger is not None:
@@ -299,7 +301,7 @@ def connect(self, clean_session=True):
299301
)[0]
300302
self._sock.connect(addr[-1], _the_interface.TCP_MODE)
301303
except RuntimeError as e:
302-
raise MMQTTException("Invalid broker address defined.", e)
304+
raise MMQTTException("Invalid broker address defined.", e) from None
303305

304306
# Fixed Header
305307
fixed_header = bytearray([0x10])

adafruit_minimqtt/matcher.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __getitem__(self, key):
5555
raise KeyError(key)
5656
return node.content
5757
except KeyError:
58-
raise KeyError(key)
58+
raise KeyError(key) from None
5959

6060
def __delitem__(self, key):
6161
"""Delete the value associated with some topic filter :key"""
@@ -67,7 +67,7 @@ def __delitem__(self, key):
6767
lst.append((parent, k, node))
6868
node.content = None
6969
except KeyError:
70-
raise KeyError(key)
70+
raise KeyError(key) from None
7171
else: # cleanup
7272
for parent, k, node in reversed(lst):
7373
if node.children or node.content is not None:

0 commit comments

Comments
 (0)