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.
In enviroments that implement it.
When an
AbortSignal#reason
has a value, i.e. in nodejs >= v17.2.0, it is added on the returnedAbortError
.AbortError#reason
would beundefined
otherwise.Contrary to the specification, when
AbortController#abort
is called, with or without a reason,fetch
does not throw theAbortSignal#reason
. This is to allow more fine grained error handling. Had thereason
was thrown, the general information that an abort happened is lost and it becomes sole responsibility of the reason provider.Purpose
Allow detecting the reason fetch was aborted.
Changes
AbortError
to have fieldreason
. It's constructor takes this additional argument.AbortSignal#reason
is given when constructingAbortError
instance. Could possibly beundefined
in environments/libraries/polyfills that do not support it.Additional information
The actual value (even existence) of
AbortSignal#reason
is external to this library. We make no assumptions about it. We simply forward it.This goes against #1519. There is no inherent reason to follow the specifications to the dot.
node-fetch
is for node, specifically, not the web. TBD.