We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a894cf0 commit 1c294fdCopy full SHA for 1c294fd
src/lib/EventStream.ts
@@ -1,3 +1,4 @@
1
+import { isAbortError } from '../internal/errors';
2
import { APIUserAbortError, OpenAIError } from '../error';
3
4
export class EventStream<EventTypes extends BaseEvents> {
@@ -145,7 +146,7 @@ export class EventStream<EventTypes extends BaseEvents> {
145
146
147
#handleError(this: EventStream<EventTypes>, error: unknown) {
148
this.#errored = true;
- if (error instanceof Error && error.name === 'AbortError') {
149
+ if (isAbortError(error)) {
150
error = new APIUserAbortError();
151
}
152
if (error instanceof APIUserAbortError) {
0 commit comments