File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,11 @@ export class ChatSession {
191191 // Errors in streamPromise are already catchable by the user as
192192 // streamPromise is returned.
193193 // Avoid duplicating the error message in logs.
194- if ( e . message !== SILENT_ERROR ) {
194+ // AbortErrors are thrown after the initial streamPromise resolves, since the request
195+ // may be aborted once streaming has begun. Since these errors won't be wrapped in a SILENT_ERROR,
196+ // we have to explicitly check for them. The user will be able to catch these AbortErrors when
197+ // awaiting the resolution of the result.response.
198+ if ( e . message !== SILENT_ERROR && e . name !== 'AbortError' ) {
195199 // Users do not have access to _sendPromise to catch errors
196200 // downstream from streamPromise, so they should not throw.
197201 logger . error ( e ) ;
You can’t perform that action at this time.
0 commit comments