pnpnpn / timeout-decorator

Timeout decorator for Python
MIT License
620 stars 96 forks source link

add __call__() to TimeoutError #38

Closed hl2055 closed 7 years ago

hl2055 commented 7 years ago

In order to easily customize error message.

pnpnpn commented 7 years ago

What is the purpose of having the __call__ method in this?

hl2055 commented 7 years ago

So we can use the value kwarg in init() to customize the error message, like: @timeout(seconds=5, timeout_exception=TimeoutError(value='Time out executing foo()')) def foo(): time.sleep(6)

On Aug 14, 2017 1:06 PM, "Patrick" notifications@github.com wrote:

What is the purpose of having the call method in this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pnpnpn/timeout-decorator/pull/38#issuecomment-322248640, or mute the thread https://github.com/notifications/unsubscribe-auth/AFutcfdb9AfxrwoaxN4xuTdHIlz-4xVsks5sYH6igaJpZM4OygPu .

hl2055 commented 7 years ago

Oh, I was just being silly and just realized the kwarg "exception_message".