Skip to content

Commit 2a8565f

Browse files
committedFeb 20, 2023
refactor: catch errors when trying to restore the connection state
1 parent d0b22c6 commit 2a8565f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎lib/namespace.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,15 @@ export class Namespace<
358358
typeof sessionId === "string" &&
359359
typeof offset === "string"
360360
) {
361-
const session = await this.adapter.restoreSession(sessionId, offset);
361+
let session;
362+
try {
363+
session = await this.adapter.restoreSession(sessionId, offset);
364+
} catch (e) {
365+
debug("error while restoring session: %s", e);
366+
}
362367
if (session) {
363368
debug("connection state recovered for sid %s", session.sid);
364369
return new Socket(this, client, auth, session);
365-
} else {
366-
debug("unable to restore session state");
367370
}
368371
}
369372
return new Socket(this, client, auth);

0 commit comments

Comments
 (0)