Heartbeat defaults and ws guard; format
This commit is contained in:
1 parent
49ada54f6d
commit
9b3c4db10d
3 files changed
+7
-4
No files matched your search
+4
-1
@@ -90,7 +90,10 @@ export async function createWaSocket(printQr: boolean, verbose: boolean) {
|
||||
);
|
||||
|
||||
// Handle WebSocket-level errors to prevent unhandled exceptions from crashing the process
|
||||
if (sock.ws) {
|
||||
if (
|
||||
sock.ws &&
|
||||
typeof (sock.ws as unknown as { on?: unknown }).on === "function"
|
||||
) {
|
||||
sock.ws.on("error", (err: Error) => {
|
||||
sessionLogger.error({ error: String(err) }, "WebSocket error");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user