| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I am not too happy this makes it hard to determine an error is cancellation |
Sorry, something went wrong.
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? |
Sorry, something went wrong.
Yes, if I have code that might cancel because of a timeout or any other cancellation before .reason I could just check err.name === 'AbortError' which was the consensus reached last time this was discussed. 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. |
Sorry, something went wrong.
|
Similar to the AbortSignal.reason, I don't think this actually breaks any patterns. Yes, it sets the reason to the TimeoutError but it's still up to applications to pay attention to that property. Any existing code that handles the abort event that ends up creating and throwing the AbortError instead will continue to work as expected. |
Sorry, something went wrong.
There was a problem hiding this comment.
_
Sorry, something went wrong.
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
|
I'll have a look tomorrow. |
Sorry, something went wrong.
Sorry, something went wrong.
Signed-off-by: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
Builds on from the AbortSignal.reason PR, which should land first.
whatwg/dom#1032 introduces a new AbortSignal.timeout() that returns an AbortSignal that triggers in the given number of milliseconds.