Skip to content

Commit 9775a8e

Browse files
authored
Fix error throwing in summarizeStreaming()
Previously it was returning rejected promises, but this method does not return promises, so it should throw the exceptions instead. I considered instead returning an immediately-errored ReadableStream. This seems a bit nicer, but a lot of precedent on the web platform points toward throwing. (Actually, most precedent is for methods returning a promise for a ReadableStream, and returning a rejected promise. I cannot find any methods that currently return a ReadableStream synchronously. But throwing is the sync analogue of returning a rejected promise.)
1 parent 8afcced commit 9775a8e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.bs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,11 +620,11 @@ The <dfn attribute for="AISummarizer">length</dfn> getter steps are to return [=
620620
<div algorithm>
621621
The <dfn method for="AISummarizer">summarizeStreaming(|input|, |options|)</dfn> method steps are:
622622

623-
1. If [=this=]'s [=relevant global object=] is a {{Window}} whose [=associated Document=] is not [=Document/fully active=], then return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}}.
623+
1. If [=this=]'s [=relevant global object=] is a {{Window}} whose [=associated Document=] is not [=Document/fully active=], then throw an "{{InvalidStateError}}" {{DOMException}}.
624624

625-
1. If [=this=]'s [=AISummarizer/destroyed=] is true, then return [=a promise rejected with=] [=this=]'s [=AISummarizer/destruction reason=].
625+
1. If [=this=]'s [=AISummarizer/destroyed=] is true, then throw [=this=]'s [=AISummarizer/destruction reason=].
626626

627-
1. If |options|["{{AISummarizerSummarizeOptions/signal}}"] [=map/exists=] and is [=AbortSignal/aborted=], then return [=a promise rejected with=] |options|["{{AISummarizerSummarizeOptions/signal}}"]'s [=AbortSignal/abort reason=].
627+
1. If |options|["{{AISummarizerSummarizeOptions/signal}}"] [=map/exists=] and is [=AbortSignal/aborted=], then throw |options|["{{AISummarizerSummarizeOptions/signal}}"]'s [=AbortSignal/abort reason=].
628628

629629
1. Let |abortedDuringSummarization| be false.
630630

0 commit comments

Comments
 (0)