mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
cleaning
This commit is contained in:
1 parent
92f8dc178f
commit
67a75d221a
1 file changed
+16
@@ -1402,12 +1402,28 @@ class Remix {
|
|||||||
|
|
||||||
const remix = new Remix();
|
const remix = new Remix();
|
||||||
|
|
||||||
|
const isIgnorableWsCrash = (err) => {
|
||||||
|
const message = String(err?.message ?? err ?? "");
|
||||||
|
const stack = String(err?.stack ?? "");
|
||||||
|
|
||||||
|
return message === "WebSocket error" &&
|
||||||
|
(
|
||||||
|
stack.includes("@fluxerjs/ws/dist/index.mjs") ||
|
||||||
|
stack.includes("node:internal/deps/undici/undici")
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
process.on("unhandledRejection", (reason, p) => {
|
process.on("unhandledRejection", (reason, p) => {
|
||||||
if (reason?.message?.includes("AudioSource is closed")) return;
|
if (reason?.message?.includes("AudioSource is closed")) return;
|
||||||
logger.error("[Error_Handling] Unhandled Rejection/Catch");
|
logger.error("[Error_Handling] Unhandled Rejection/Catch");
|
||||||
logger.error("Reason:", reason, p);
|
logger.error("Reason:", reason, p);
|
||||||
});
|
});
|
||||||
process.on("uncaughtException", (err, origin) => {
|
process.on("uncaughtException", (err, origin) => {
|
||||||
|
if (isIgnorableWsCrash(err)) {
|
||||||
|
logger.warn("[Error_Handling] Suppressed recoverable websocket transport crash.");
|
||||||
|
logger.warn("Error:", err?.stack ?? err, origin);
|
||||||
|
return;
|
||||||
|
}
|
||||||
logger.error("[Error_Handling] Uncaught Exception/Catch");
|
logger.error("[Error_Handling] Uncaught Exception/Catch");
|
||||||
logger.error("Error:", err, origin);
|
logger.error("Error:", err, origin);
|
||||||
// Node.js is in an undefined state after an uncaughtException.
|
// Node.js is in an undefined state after an uncaughtException.
|
||||||
|
|||||||
Reference in new issue
Block a user