Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is done in 2 ways:
signal
option torethrow()
andignore()
.AbortSignal
derived aborts and timeouts.Regarding 1, this allows a
Bounce
user to simply hook asignal.rethrowIfAborted()
into the call. Eg.:Alternatively, you would need an extra
signal.rethrowIfAborted()
before the call to Bounce, which gets verbose:Regarding 2, the default errors thrown when calling
abort()
ortimeout()
have no shared prototype and have changed in various node releases. As such you cannot do aninstanceof
check with eg.Bounce.rethrow(err, AbortError)
. The most compatible way to detect this, is to simply check that thename
property isAbortError
. Given this, I have added shortcuts to do it safely.Note that I have marked these as breaking, not because of the API changes, but solely because it requires more modern versions of node (v16.17+) then the current release.