aboutsummaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorlevi-rs <levi.noecker@rewardstyle.com>2017-01-18 12:52:52 -0600
committerlevi-rs <levi.noecker@rewardstyle.com>2017-02-07 09:47:53 -0600
commit8e3c852a82487194499f50bc7940b7cf99d5044b (patch)
tree6530925525d1dd7448b85631413cbc3172acb305 /README.rst
parentaab544fa51e208d903ed6eef98085a7dab6a552b (diff)
downloadtimeout-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.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index 5573180..e04b76c 100644
--- a/README.rst
+++ b/README.rst
@@ -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
--------------