mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 09:20:08 +00:00
Handle WebSocket#error event
This commit is contained in:
@@ -63,8 +63,9 @@ export async function createShard(
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: handle the WebSocket#error event
|
||||
// socket.onerror = () => {};
|
||||
socket.onerror = ({ timeStamp }) => {
|
||||
eventHandlers.debug?.({ type: "websocketErrored", data: { timeStamp } });
|
||||
};
|
||||
|
||||
socket.onmessage = ({ data: message }) => {
|
||||
if (message instanceof ArrayBuffer) {
|
||||
@@ -160,6 +161,7 @@ export async function createShard(
|
||||
"Shard.ts: Error occurred that is not resumeable or able to be reconnected.",
|
||||
);
|
||||
}
|
||||
|
||||
// These error codes can not be resumed but need to reconnect from start
|
||||
if ([4003, 4007, 4008, 4009].includes(code)) {
|
||||
eventHandlers.debug?.(
|
||||
|
||||
Reference in New Issue
Block a user