Expose underlying futures.CancelledError

When a future is cancelled and the result is fetched
it will raise a CancelledError which is quite useful to
be able to catch.

So to enable catching that specific exception expose it
in futurist __init__.py so that people can easily catch
it just by catching futurist.CancelledError and handling
the outcome of that.

Change-Id: I7bc1838aadcbb8cd0d635da83bb1e1b1ec761e89
This commit is contained in:
Joshua Harlow 2016-01-26 17:11:20 -08:00
parent 7361553319
commit 588c0770e9
2 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,8 @@
from futurist._futures import Future # noqa
from futurist._futures import GreenFuture # noqa
from futurist._futures import CancelledError # noqa
from futurist._futures import GreenThreadPoolExecutor # noqa
from futurist._futures import ProcessPoolExecutor # noqa
from futurist._futures import SynchronousExecutor # noqa

View File

@ -26,6 +26,9 @@ from futurist import _green
from futurist import _utils
CancelledError = _futures.CancelledError
class RejectedSubmission(Exception):
"""Exception raised when a submitted call is rejected (for some reason)."""