Skip to content

Commit de79828

Browse files
committed
Fix interrupted state for non-status codes.
1 parent 84c62b9 commit de79828

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

packages/shared/sdk-client/src/datasource/fdv2/StreamingFDv2Base.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Requests,
1010
ServiceEndpoints,
1111
shouldRetry,
12+
DataSourceErrorKind,
1213
} from '@launchdarkly/js-sdk-common';
1314

1415
import { processFlagEval } from '../flagEvalMapper';
@@ -280,8 +281,16 @@ export function createStreamingBase(config: {
280281
config.logger?.info('Closed LaunchDarkly stream connection');
281282
};
282283

283-
es.onerror = () => {
284-
// Error handling is done by errorFilter.
284+
es.onerror = (err?: HttpErrorResponse) => {
285+
if(err && typeof err.status === 'number') {
286+
// This condition will be handled by the error filter.
287+
return;
288+
}
289+
resultQueue.put(interrupted({
290+
kind: DataSourceErrorKind.NetworkError,
291+
message: err?.message ?? 'IO Error',
292+
time: Date.now(),
293+
}, fdv1Fallback));
285294
};
286295

287296
es.onopen = () => {

0 commit comments

Comments
 (0)