Skip to content

Node.js based forum software built for the modern web

fix: make socket errors and static hook errors less noisy

Julian Lam2a1be01ac09e
diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js
index 2282e8fe4c..197af92b3d 100644
--- a/src/plugins/hooks.js
+++ b/src/plugins/hooks.js
@@ -335,10 +335,11 @@ async function fireStaticHook(hook, hookList, params) {
if (err && err.message === 'timeout') {
winston.warn(`[plugins] Callback timed out, hook '${hook}' in plugin '${hookObj.id}'`);
} else {
- winston.error(`[plugins] Error executing '${hook}' in plugin '${hookObj.id}'\n${err.stack}`);
if (!noErrorHooks.includes(hook)) {
throw err;
}
+
+ winston.error(`[plugins] Error executing '${hook}' in plugin '${hookObj.id}'\n${err.stack}`);
}
}
}
diff --git a/src/socket.io/index.js b/src/socket.io/index.js
index 6db0719380..8f03eb2a9d 100644
--- a/src/socket.io/index.js
+++ b/src/socket.io/index.js
@@ -211,7 +211,7 @@ async function onMessage(socket, payload) {
});
}
} catch (err) {
- winston.error(`${event}\n${err.stack ? err.stack : err.message}`);
+ winston.debug(`${event}\n${err.stack ? err.stack : err.message}`);
callback({ message: err.message });
}
}
@@ -257,7 +257,6 @@ async function validateSession(socket, errorMsg) {
}
const sessionData = await getSessionAsync(sessionId);
-
if (!sessionData) {
throw new Error(errorMsg);
}