1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-27 01:57:33 +00:00
bazarr/libs/socketio/exceptions.py

35 lines
924 B
Python
Raw Normal View History

2020-01-30 01:07:26 +00:00
class SocketIOError(Exception):
pass
class ConnectionError(SocketIOError):
pass
class ConnectionRefusedError(ConnectionError):
"""Connection refused exception.
This exception can be raised from a connect handler when the connection
is not accepted. The positional arguments provided with the exception are
returned with the error packet to the client.
"""
def __init__(self, *args):
if len(args) == 0:
self.error_args = {'message': 'Connection rejected by server'}
elif len(args) == 1:
self.error_args = {'message': str(args[0])}
2020-01-30 01:07:26 +00:00
else:
self.error_args = {'message': str(args[0])}
if len(args) == 2:
self.error_args['data'] = args[1]
else:
self.error_args['data'] = args[1:]
2020-01-30 01:07:26 +00:00
class TimeoutError(SocketIOError):
pass
class BadNamespaceError(SocketIOError):
pass