From 94b5ce7ed383e41f72e6cc174e27c86b7739971b Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Mon, 1 Feb 2016 16:36:00 -0700 Subject: [PATCH] Added function on wait error. --- socketIO_client/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/socketIO_client/__init__.py b/socketIO_client/__init__.py index 2fe82fe..208e139 100644 --- a/socketIO_client/__init__.py +++ b/socketIO_client/__init__.py @@ -237,7 +237,7 @@ class SocketIO(object): callback, args = find_callback(args, kw) 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. - Omit seconds, i.e. call wait() without arguments, to wait forever. @@ -254,8 +254,8 @@ class SocketIO(object): pass next(self._heartbeat_pacemaker) except ConnectionError as e: - if raise_error: - raise + if on_error is not None and callable(on_error): + on_error(e, error_args) try: warning = Exception('[connection error] %s' % e) warning_screen.throw(warning)