fix: make socket errors and static hook errors less noisy

This commit is contained in:
Julian Lam
2023-10-03 12:02:56 -04:00
parent 0b0c38eb84
commit 2a1be01ac0
2 changed files with 3 additions and 3 deletions

View File

@@ -335,10 +335,11 @@ async function fireStaticHook(hook, hookList, params) {
if (err && err.message === 'timeout') { if (err && err.message === 'timeout') {
winston.warn(`[plugins] Callback timed out, hook '${hook}' in plugin '${hookObj.id}'`); winston.warn(`[plugins] Callback timed out, hook '${hook}' in plugin '${hookObj.id}'`);
} else { } else {
winston.error(`[plugins] Error executing '${hook}' in plugin '${hookObj.id}'\n${err.stack}`);
if (!noErrorHooks.includes(hook)) { if (!noErrorHooks.includes(hook)) {
throw err; throw err;
} }
winston.error(`[plugins] Error executing '${hook}' in plugin '${hookObj.id}'\n${err.stack}`);
} }
} }
} }

View File

@@ -211,7 +211,7 @@ async function onMessage(socket, payload) {
}); });
} }
} catch (err) { } 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 }); callback({ message: err.message });
} }
} }
@@ -257,7 +257,6 @@ async function validateSession(socket, errorMsg) {
} }
const sessionData = await getSessionAsync(sessionId); const sessionData = await getSessionAsync(sessionId);
if (!sessionData) { if (!sessionData) {
throw new Error(errorMsg); throw new Error(errorMsg);
} }