Re: [whatwg/fetch] Add abort reason to abort fetch (PR #1343)

@annevk commented on this pull request.

Thank you! I'd appreciate another look from @domenic and @noamr (if available) and I think we should address the null-vs-undefined issue and we should probably introduce a shared algorithm given that we do the same thing three times, but otherwise this seems good to go.

> @@ -231,6 +231,9 @@ lt="authentication entry">authentication entries</a> (for HTTP authentication).
 
  <dt><dfn for="fetch controller">report timing steps</dfn> (default null)
  <dd>Null or an algorithm accepting a <a for=/>global object</a>.
+
+ <dt><dfn for="fetch controller">serialized abort reason</dfn> (default null)
+ <dd>Null or a serialization from [$StructuredSerialize$].

Should this be undefined by default and not allow for null? It seems that otherwise we change the value space subtly from how it works with `AbortSignal`, no?

> @@ -254,8 +257,20 @@ given a <a>fetch controller</a> <var>controller</var>:
 </ol>
 
 <p>To <dfn export for="fetch controller">abort</dfn> a <a for=/>fetch controller</a>
-<var>controller</var>, set <var>controller</var>'s <a for="fetch controller">state</a> to
-"<code>aborted</code>".
+<var>controller</var> with an optional <var>error</var>:
+
+<ol>
+ <li><p>Set <var>controller</var>'s <a for="fetch controller">state</a> to "<code>aborted</code>".
+
+ <li><p>Set <var>error</var> to an "{{AbortError}}" {{DOMException}} if it is not given.
+
+ <li><p>Let <var>serializedError</var> be [$StructuredSerialize$](<var>error</var>).
+ If that threw an exception, catch it, and let <var>serializedError</var> be
+ [$StructuredSerialize$](a new "{{AbortError}}" {{DOMException}}).

Should this also do the "or returns undefined" dance that the text below performs? Perhaps we should have a shared algorithm?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1343#pullrequestreview-1127073354
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1343/review/1127073354@github.com>

Received on Friday, 30 September 2022 16:36:09 UTC