From bedbe954edf2b01f2584280d0ffcbae465be3b77 Mon Sep 17 00:00:00 2001 From: undefined Date: Sat, 31 Jul 2021 13:22:44 +0800 Subject: [PATCH] judge: add debug info --- packages/hydrojudge/package.json | 2 +- packages/hydrojudge/src/hosts/hydro.ts | 4 +++- packages/hydrojudge/src/service.ts | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 6d2c2eb24..e94b6e86e 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,7 +1,7 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.9.1", + "version": "2.9.2", "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", diff --git a/packages/hydrojudge/src/hosts/hydro.ts b/packages/hydrojudge/src/hosts/hydro.ts index 30f79e298..224fd1bf9 100644 --- a/packages/hydrojudge/src/hosts/hydro.ts +++ b/packages/hydrojudge/src/hosts/hydro.ts @@ -114,7 +114,9 @@ class JudgeTask { { next: this.next, key: md5(`${this.domainId}${this.pid}${getConfig('secret')}`) }, ); this.stat.judge = new Date(); - await judge[this.config.type || 'default'].judge(this); + const type = this.config.type || 'default'; + if (!judge[type]) throw new FormatError('Unrecognized problemType: {0}', [type]); + await judge[type].judge(this); } next(data, id?: number) { diff --git a/packages/hydrojudge/src/service.ts b/packages/hydrojudge/src/service.ts index 38c3e1d4d..fba513071 100644 --- a/packages/hydrojudge/src/service.ts +++ b/packages/hydrojudge/src/service.ts @@ -237,7 +237,9 @@ async function postInit() { { next: this.next, key: md5(`${this.domainId}${this.pid}${getConfig('secret')}`) }, ); this.stat.judge = new Date(); - await judge[this.config.type || 'default'].judge(this); + const type = this.config.type || 'default'; + if (!judge[type]) throw new FormatError('Unrecognized problemType: {0}', [type]); + await judge[type].judge(this); } async run() {