- From: Anne van Kesteren <notifications@github.com>
- Date: Wed, 27 Oct 2021 00:19:14 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1343/review/790231572@github.com>
@annevk commented on this pull request.
Unfortunately I think this integration is more complex and it might be best to build on top of @noamr's #1329.
In particular, the problem is this line:
> Terminate the ongoing fetch with the aborted flag set.
That in turn is used to cancel the stream with an "`AbortError`" deep in the overall fetch algorithm. What we want to do instead is use the reason there.
> @@ -7428,12 +7428,16 @@ method steps are:
<li><p>Let <var>request</var> be <var>requestObject</var>'s <a for=Request>request</a>.
+ <li><p>If <var>requestObject</var>'s <a for=Request>signal</a> is an {{AbortSignal}}, let
+ <var>error</var> be <var>requestObject</var>'s <a for=Request>signal</a>'s
+ <a for=AbortSignal>abort reason</a>, and undefined otherwise.
`Request`'s `signal` is always an `AbortSignal` so this can be a lot simpler.
> + <li><p>If <var>error</var> is not given, let <var>error</var> be an
+ "<code><a exception>AbortError</a></code>" {{DOMException}}.
_error_ is always given I think, but it can be undefined. I think the text here and in Streams suggest we should have this primitive in DOM.
Something like
> To **get an error for an abort reason**, given a JavaScript value _reason_, run these steps:
> 1. If _reason_ is undefined, then return a new "`AbortError`" `DOMException`.
> 2. Return _reason_.
What do you think?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1343#pullrequestreview-790231572
Received on Wednesday, 27 October 2021 07:19:26 UTC