timeout-decorator icon indicating copy to clipboard operation
timeout-decorator copied to clipboard

feature request: timeout_exception=None to terminate function without raising exception

Open mdavis-xyz opened this issue 4 years ago • 0 comments

I have some code where I save some non-essential logging information to AWS CloudWatch. Often it takes too long, so I use this timeout decorator. But if it does time out, I don't want my whole script to fail. I want to ignore the timeout error and continue. Currently I need to wrap the code that invokes my decorated function in a try/except block. I would like to be able to tell the decorator to not raise any exception when the function times out. Just stop the function, and then return None.

timeout_exception=None would be one possible way to do this. Or perhaps a new argument?

mdavis-xyz avatar Oct 06 '21 22:10 mdavis-xyz