codekingpro/portable-devtools
114k
1class SocketIOError(Exception):2 pass3 4 5class ConnectionError(SocketIOError):6 pass7 8 9class ConnectionRefusedError(ConnectionError):10 """Connection refused exception.11 12 This exception can be raised from a connect handler when the connection13 is not accepted. The positional arguments provided with the exception are14 returned with the error packet to the client.15 """16 def __init__(self, *args):17 if len(args) == 0:18 self.error_args = {'message': 'Connection rejected by server'}19 elif len(args) == 1:20 self.error_args = {'message': str(args[0])}21 else:22 self.error_args = {'message': str(args[0])}23 if len(args) == 2:24 self.error_args['data'] = args[1]25 else:26 self.error_args['data'] = args[1:]27 28 29class TimeoutError(SocketIOError):30 pass31 32 33class BadNamespaceError(SocketIOError):34 pass35 36 37class DisconnectedError(SocketIOError):38 pass39 