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 21
21
22
22
import json
23
23
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
+
24
32
class AdafruitIOError (Exception ):
25
33
"""Base class for all Adafruit IO request failures."""
26
34
pass
@@ -49,3 +57,11 @@ def __init__(self):
49
57
super (ThrottlingError , self ).__init__ ("Exceeded the limit of Adafruit IO " \
50
58
"requests in a short period of time. Please reduce the rate of requests " \
51
59
"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