Skip to content

Commit 413ad7d

Browse files
committed
Changed websocket on error handling to better handle communication with older services.
1 parent 75a0781 commit 413ad7d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/common/src/client/sync/stream/AbstractRemote.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,17 @@ export abstract class AbstractRemote {
396396
syncQueueRequestSize, // The initial N amount
397397
{
398398
onError: (e) => {
399-
if (e.message.includes('Authorization failed') || e.message.includes('PSYNC_S21')) {
400-
this.invalidateCredentials();
399+
if (e.message.includes('PSYNC_')) {
400+
if (e.message.includes('PSYNC_S21')) {
401+
this.invalidateCredentials();
402+
}
403+
} else {
404+
// Possible that connection is with an older service, always invalidate to be safe
405+
if (e.message !== 'Closed. ') {
406+
this.invalidateCredentials();
407+
}
401408
}
409+
402410
// Don't log closed as an error
403411
if (e.message !== 'Closed. ') {
404412
this.logger.error(e);

0 commit comments

Comments
 (0)