[Twisted-Python] giving a reason when adding a timeout

Adi Roiban adi at roiban.ro
Wed Mar 13 06:24:58 MDT 2019


Hi,

On Wed, 13 Mar 2019 at 11:21, Chris Withers <chris at withers.org> wrote:
>
> Hi All,
>
> Unless I'm missing something, Deferred.addTimeout is really unhelpful in
> terms on providing context about *what* timed out.
> TimeoutError(<some number>, 'Deferred') just isn't that useful.
>
> How come addTimeout doesn't let you specify a textual reason, or
> otherwise provide some context about the timeout?
>
> Am I missing something obvious here?

I don't know what kind of context do you need :)

You can add your own errback and add your extra error handling there.

There is also onTimeoutCancel argument.

If there is anything missing from the API, feel free to send a pull
request in GitHub.

I guess that it was implemented in this way as the current
implementation serves the purpose for the people who have added the
support for timeout.

Regards,
Adi



> Chris
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python



-- 
Adi Roiban




More information about the Twisted-Python mailing list