Added function on wait error.
This commit is contained in:
parent
2c1e2ed373
commit
94b5ce7ed3
1 changed files with 3 additions and 3 deletions
|
|
@ -237,7 +237,7 @@ class SocketIO(object):
|
||||||
callback, args = find_callback(args, kw)
|
callback, args = find_callback(args, kw)
|
||||||
self._transport.emit(path, event, args, callback)
|
self._transport.emit(path, event, args, callback)
|
||||||
|
|
||||||
def wait(self, seconds=None, for_callbacks=False, raise_error=False):
|
def wait(self, seconds=None, for_callbacks=False, on_error=None, error_args=None):
|
||||||
"""Wait in a loop and process events as defined in the namespaces.
|
"""Wait in a loop and process events as defined in the namespaces.
|
||||||
|
|
||||||
- Omit seconds, i.e. call wait() without arguments, to wait forever.
|
- Omit seconds, i.e. call wait() without arguments, to wait forever.
|
||||||
|
|
@ -254,8 +254,8 @@ class SocketIO(object):
|
||||||
pass
|
pass
|
||||||
next(self._heartbeat_pacemaker)
|
next(self._heartbeat_pacemaker)
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
if raise_error:
|
if on_error is not None and callable(on_error):
|
||||||
raise
|
on_error(e, error_args)
|
||||||
try:
|
try:
|
||||||
warning = Exception('[connection error] %s' % e)
|
warning = Exception('[connection error] %s' % e)
|
||||||
warning_screen.throw(warning)
|
warning_screen.throw(warning)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue