Skip to content

Commit 054f16b

Browse files
committed
fix(client): Network errors during event emission contain the keyword "stream" in Firefox
1 parent 3f516d7 commit 054f16b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/client.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,10 @@ async function connect<SingleConnection extends boolean>(
733733
}
734734
}
735735
} catch (err) {
736-
// non-network errors shouldn't ever have "network" in the message, right?
737-
error = /network/i.test(err) ? new NetworkError(err) : err;
736+
// non-network errors shouldn't ever have "network" or "stream" in the message, right?
737+
// keyword "network" is for Chrome and keyword "stream" is for Firefox
738+
// TODO: Safari actually completes the stream instead of erroring out, handle that too.
739+
error = /network|stream/i.test(err) ? new NetworkError(err) : err;
738740
waitingForThrow?.(error);
739741
} finally {
740742
Object.values(waiting).forEach(({ proceed }) => proceed());

0 commit comments

Comments
 (0)