mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	fix: make socket errors and static hook errors less noisy
This commit is contained in:
		| @@ -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}`); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -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); | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user