core: log error detail in ws conn

This commit is contained in:
undefined committed 2025-10-06 08:50:22 +08:00
1 parent 3a25e4e53f
commit be86224286
1 file changed
+2 -1
+2 -1
View File
@@ -240,7 +240,8 @@ export async function apply(ctx: Context) {
server.wsHandlerMixin({
async onerror(err: HydroError) {
if (![NotFoundError, PrivilegeError, PermissionError].some((i) => err instanceof i) || this.user?._id !== 0) {
logger.error(`Path:${this.request.path}, User:${this.user?._id}(${this.user?.uname})`);
const msg = 'msg' in err ? err.msg() : (err as any)?.message || '';
logger.error(`Path:${this.request.path}, User:${this.user?._id}(${this.user?.uname})`, msg, err.params);
logger.error(err);
}
if (err instanceof UserFacingError) err.stack = this.request.path;