Skip to content

Commit aea8ba1

Browse files
committed
Added the possibility to errback() on AsyncTokens directly with an exception object
1 parent f1d5915 commit aea8ba1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

swingutils/threads/defer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ def callback(self, result):
5858
self._result = result
5959
self._runCallbacks()
6060

61-
def errback(self):
62-
self._result = Failure(*sys.exc_info())
61+
def errback(self, exception=None, traceback=None):
62+
if exception:
63+
self._result = Failure(type(exception), exception, traceback)
64+
else:
65+
self._result = Failure(*sys.exc_info())
6366
self._runCallbacks()
6467

6568
def _runCallbacks(self):

0 commit comments

Comments
 (0)