diff options
author | levi-rs <levi.noecker@rewardstyle.com> | 2017-01-18 12:52:52 -0600 |
---|---|---|
committer | levi-rs <levi.noecker@rewardstyle.com> | 2017-02-07 09:47:53 -0600 |
commit | 8e3c852a82487194499f50bc7940b7cf99d5044b (patch) | |
tree | 6530925525d1dd7448b85631413cbc3172acb305 /README.rst | |
parent | aab544fa51e208d903ed6eef98085a7dab6a552b (diff) | |
download | timeout-decorator-8e3c852a82487194499f50bc7940b7cf99d5044b.tar.gz |
Add ability to specify what exception gets raised
- Add keyword argument to decorator that allows the user to specify what
exception is raised when the timeout is triggered
- Bump version to 0.3.3
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -36,6 +36,23 @@ Usage if __name__ == '__main__': mytest() +Specify an alternate exception to raise on timeout: + +:: + + import time + import timeout_decorator + + @timeout_decorator.timeout(5, timeout_exception=StopIteration) + def mytest(): + print "Start" + for i in range(1,10): + time.sleep(1) + print "%d seconds have passed" % i + + if __name__ == '__main__': + mytest() + Multithreading -------------- |