pnpnpn / timeout-decorator

Timeout decorator for Python
MIT License
628 stars 94 forks source link

Doesn't use the built-in TimeoutError #49

Open terrdavis opened 6 years ago

terrdavis commented 6 years ago

Why don't you use the built-in exception?

majiang commented 3 years ago

The reason I think is that built-in TimeoutError is "Raised when a system function timed out at the system level.

Besides, using the same name TimeoutError seems error-prone (that's why I searched the issues for the name and found this one).

bfontaine commented 3 years ago

It might be a good solution to use something like class TimeoutDecoratorError(TimeoutError): a class with a different name that inherits from the built-in exception.

majiang commented 3 years ago

If you inherited you would say "a TimeoutDeoratorError is a TimeoutError" which is system level by built-in definition. We should rather just rename the TimeoutError to a non-confusing alternative.

bfontaine commented 3 years ago

That’s true. requests uses Timeout to avoid the confusion with the built-in TimeoutError.