You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, cancelling a target context can close its tab, or shutdown the entire browser. The cancel() call blocks until whichever action is finished, meaning that we don't leak resources like files ondisk.
However, those actions can cause errors. Right now, some are ignored, and some others are just logged. We should instead allow the user to collect them.
We can't add this to cancel() directly, as the signature is fixed by the context package.
I can think of multiple options. The first is to add a field to the Context type, so that then one can do:
Another way would be to hijack the context.Context.Err() method, but it's documented to only return nil or one of the few standard context errors. This would also break if anyone layers a context on top of ours. Still, the API would be nice, if we can look past the weird semantics:
cancel()
if err := ctx.Err(); err != nil {
// ...
The text was updated successfully, but these errors were encountered:
For example, cancelling a target context can close its tab, or shutdown the entire browser. The
cancel()
call blocks until whichever action is finished, meaning that we don't leak resources like files ondisk.However, those actions can cause errors. Right now, some are ignored, and some others are just logged. We should instead allow the user to collect them.
We can't add this to
cancel()
directly, as the signature is fixed by the context package.I can think of multiple options. The first is to add a field to the
Context
type, so that then one can do:A similar way would be to add an API to grab the error from the context:
Another way would be to hijack the
context.Context.Err()
method, but it's documented to only return nil or one of the few standard context errors. This would also break if anyone layers a context on top of ours. Still, the API would be nice, if we can look past the weird semantics:The text was updated successfully, but these errors were encountered: