-
-
Notifications
You must be signed in to change notification settings - Fork 358
Open
Description
Occasionally we end up digging through logs trying to work out why something was cancelled, and eventually it occurred to me that Trio could help with this. I don't have a complete design proposal, but it would be great to handle each of three cases:
- a deadline was reached.
- a sibling task in the
Nursery
raised an exception, including the name of the erroring task - someone called
CancelScope.cancel()
, including the name of the task in which this was called- add a new
reason: str | None = None
param, so that users can explicitly annotate why they cancelled something
- add a new
I think we could represent this as a string argument to Cancelled
like any other exception message; the only tricky part will be threading it through all the cancellation-delivery machinery 🙂
Comments and design input most welcome, of course!
samkio