File tree Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Original file line number Diff line number Diff line change @@ -52,35 +52,6 @@ export interface FetchEventSourceInit extends RequestInit {
5252 fetch ?: typeof fetch ;
5353}
5454
55- class RetriableError extends Error { }
56- class FatalError extends Error { }
57-
58- fetchEventSource ( '/api/sse' , {
59- async onopen ( response ) {
60- response . ok
61- if ( response . status === 429 ) {
62- throw new RetriableError ( ) ;
63- }
64- } ,
65- onmessage ( msg ) {
66- if ( msg . event === 'FatalError' ) {
67- throw new FatalError ( msg . data ) ;
68- }
69- } ,
70- onclose ( ) {
71- // if the server closes the connection unexpectedly, retry:
72- throw new RetriableError ( ) ;
73- } ,
74- onerror ( err ) {
75- if ( err instanceof FatalError ) {
76- throw err ; // rethrow to stop the operation
77- } else {
78- // do nothing to automatically retry. You can also return
79- // a specific retry interval instead.
80- }
81- }
82- } ) ;
83-
8455export function fetchEventSource ( input : RequestInfo , {
8556 signal : inputSignal ,
8657 headers : inputHeaders ,
@@ -158,7 +129,6 @@ export function fetchEventSource(input: RequestInfo, {
158129
159130 await parseResponse ( response ) ;
160131
161- // if the event stream closes
162132 onclose ?.( ) ;
163133 dispose ( ) ;
164134 resolve ( ) ;
You can’t perform that action at this time.
0 commit comments