File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 2121
2222import json
2323
24+ # MQTT RC Error Types
25+ MQTT_ERRORS = [ 'Connection successful' ,
26+ 'Incorrect protocol version' ,
27+ 'Invalid Client ID' ,
28+ 'Server unavailable ' ,
29+ 'Bad username or password' ,
30+ 'Not authorized' ]
31+
2432class AdafruitIOError (Exception ):
2533 """Base class for all Adafruit IO request failures."""
2634 pass
@@ -49,3 +57,11 @@ def __init__(self):
4957 super (ThrottlingError , self ).__init__ ("Exceeded the limit of Adafruit IO " \
5058 "requests in a short period of time. Please reduce the rate of requests " \
5159 "and try again later." )
60+
61+ class MQTTError (Exception ):
62+ """Handles connection attempt failed errors.
63+ """
64+ def __init__ (self , response ):
65+ error = MQTT_ERRORS [response ]
66+ super (MQTTError , self ).__init__ (error )
67+ pass
You can’t perform that action at this time.
0 commit comments