|
28 | 28 | from AWSIoTPythonSDK.core.protocol.internal.defaults import METRICS_PREFIX |
29 | 29 | from AWSIoTPythonSDK.core.protocol.internal.defaults import ALPN_PROTCOLS |
30 | 30 | from AWSIoTPythonSDK.core.protocol.internal.events import FixedEventMids |
31 | | -from AWSIoTPythonSDK.core.protocol.paho.client import MQTT_ERR_SUCCESS |
32 | | -from AWSIoTPythonSDK.core.protocol.paho.client import MQTT_ERR_SUBACK_ERROR |
| 31 | +from AWSIoTPythonSDK.core.protocol.paho.client import MQTT_ERR_SUCCESS, SUBACK_ERROR |
33 | 32 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import connectError |
34 | 33 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import connectTimeoutException |
35 | 34 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import disconnectError |
|
42 | 41 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import subscribeQueueDisabledException |
43 | 42 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import unsubscribeQueueFullException |
44 | 43 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import unsubscribeQueueDisabledException |
45 | | -from AWSIoTPythonSDK.exception.AWSIoTExceptions import subscribeError |
| 44 | +from AWSIoTPythonSDK.exception.AWSIoTExceptions import subscribeError, subackError |
46 | 45 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import subscribeTimeoutException |
47 | 46 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import unsubscribeError |
48 | 47 | from AWSIoTPythonSDK.exception.AWSIoTExceptions import unsubscribeTimeoutException |
@@ -311,9 +310,9 @@ def subscribe(self, topic, qos, message_callback=None): |
311 | 310 | self._internal_async_client.remove_event_callback(mid) |
312 | 311 | self._logger.error("Subscribe timed out") |
313 | 312 | raise subscribeTimeoutException() |
314 | | - if suback.data and suback.data[0] == MQTT_ERR_SUBACK_ERROR: |
315 | | - self._logger.error(f"Subscribe error: {suback.data}") |
316 | | - raise subscribeError(suback.data) |
| 313 | + if suback.data and suback.data[0] == SUBACK_ERROR: |
| 314 | + self._logger.error(f"Suback error return code: {suback.data[0]}") |
| 315 | + raise subackError(suback=suback.data) |
317 | 316 | ret = True |
318 | 317 | return ret |
319 | 318 |
|
|
0 commit comments