Conversation
|
I am not too happy this makes it hard to determine an error is cancellation |
I don't understand. This sets the reason to a TimeoutError whose stack clearly shows it coming from an AbortSignal. And the code still has to be written to use the reason, which is optional. Can you explain? |
a8362d8 to
f04a7fb
Compare
Yes, if I have code that might cancel because of a timeout or any other cancellation before This method adds a new way to timeout an action that rejects with an error that isn't AbortError. I want to make sure users have a clean way to handle this. |
|
Similar to the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
aab9e13 to
820e505
Compare
This comment has been minimized.
This comment has been minimized.
|
@targos ... please take another look. I updated the implementation to ensure that the underlying timer would not prevent the AbortSignal from being garbage collected and to unref the timer object so that the timer would not keep the event loop from exiting. |
cf9cb71 to
ed3f0f9
Compare
|
I'll have a look tomorrow. |
Signed-off-by: James M Snell <jasnell@gmail.com>
Builds on from the AbortSignal.reason PR, which should land first.
whatwg/dom#1032 introduces a new
AbortSignal.timeout()that returns anAbortSignalthat triggers in the given number of milliseconds.