From 0f75f7ce36edcf4eafc4a3b0fa5394492034b435 Mon Sep 17 00:00:00 2001 From: 035966-L3 <139025318+035966-L3@users.noreply.github.com> Date: Wed, 24 Dec 2025 07:17:38 +0800 Subject: [PATCH] ui: add missing 'domainId' for error tracing (#1092) --- packages/hydrooj/src/handler/discussion.ts | 8 ++++---- packages/hydrooj/src/handler/problem.ts | 2 +- packages/hydrooj/src/model/contest.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/hydrooj/src/handler/discussion.ts b/packages/hydrooj/src/handler/discussion.ts index ebaba2b9a..44667e6ae 100644 --- a/packages/hydrooj/src/handler/discussion.ts +++ b/packages/hydrooj/src/handler/discussion.ts @@ -357,10 +357,10 @@ class DiscussionRawHandler extends DiscussionHandler { } else { const [doc] = await discussion.getHistory(domainId, drrid || drid || did, ts ? { time: new Date(ts) } : {}); if (!doc) { - if (ts) throw new DiscussionNotFoundError(drrid || drid || did); - if (drrid && !this.drrdoc) throw new DiscussionNotFoundError(drrid); - if (drid && !this.drdoc) throw new DiscussionNotFoundError(drid); - if (did && !this.ddoc) throw new DiscussionNotFoundError(did); + if (ts) throw new DiscussionNotFoundError(domainId, drrid || drid || did); + if (drrid && !this.drrdoc) throw new DiscussionNotFoundError(domainId, drrid); + if (drid && !this.drdoc) throw new DiscussionNotFoundError(domainId, drid); + if (did && !this.ddoc) throw new DiscussionNotFoundError(domainId, did); } this.response.type = 'text/markdown'; this.response.body = doc ? doc.content : drrid ? this.drrdoc.content : drid ? this.drdoc.content : this.ddoc.content; diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 042869563..e2fa80edf 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -915,7 +915,7 @@ export class ProblemSolutionHandler extends ProblemDetailHandler { @param('psrid', Types.ObjectId) async postDeleteReply(domainId: string, psid: ObjectId, psrid: ObjectId) { const [psdoc, psrdoc] = await solution.getReply(domainId, psid, psrid); - if (!psdoc || psdoc.parentId !== this.pdoc.docId) throw new SolutionNotFoundError(psid); + if (!psdoc || psdoc.parentId !== this.pdoc.docId) throw new SolutionNotFoundError(domainId, psid); if (!this.user.own(psrdoc) || !this.user.hasPerm(PERM.PERM_DELETE_PROBLEM_SOLUTION_REPLY_SELF)) { this.checkPerm(PERM.PERM_DELETE_PROBLEM_SOLUTION_REPLY); } diff --git a/packages/hydrooj/src/model/contest.ts b/packages/hydrooj/src/model/contest.ts index a86628336..bd9f9aa0e 100644 --- a/packages/hydrooj/src/model/contest.ts +++ b/packages/hydrooj/src/model/contest.ts @@ -846,7 +846,7 @@ export async function del(domainId: string, tid: ObjectId) { export async function get(domainId: string, tid: ObjectId): Promise { const tdoc = await document.get(domainId, document.TYPE_CONTEST, tid); - if (!tdoc) throw new ContestNotFoundError(tid); + if (!tdoc) throw new ContestNotFoundError(domainId, tid); return tdoc; }