From be862242865d40b0ccc8bef910c7570daf4c9e40 Mon Sep 17 00:00:00 2001 From: undefined Date: Mon, 6 Oct 2025 08:50:22 +0800 Subject: [PATCH] core: log error detail in ws conn --- packages/hydrooj/src/service/server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/hydrooj/src/service/server.ts b/packages/hydrooj/src/service/server.ts index 0b5dc130b..01b6499c9 100644 --- a/packages/hydrooj/src/service/server.ts +++ b/packages/hydrooj/src/service/server.ts @@ -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;