mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
judge: throw FormatError when problem data not found
This commit is contained in:
1 parent
785dcc1628
commit
00402f2782
5 files changed
+6
-6
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.12.8",
|
||||
"version": "2.12.9",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -182,7 +182,7 @@ export default class Hydro {
|
||||
const [domainId, pid] = source.split('/');
|
||||
const filePath = path.join(getConfig('cache_dir'), this.config.host, source);
|
||||
await fs.ensureDir(filePath);
|
||||
if (!files?.length) throw new SystemError('Problem data not found.');
|
||||
if (!files?.length) throw new FormatError('Problem data not found.');
|
||||
let etags: Record<string, string> = {};
|
||||
try {
|
||||
etags = JSON.parse(fs.readFileSync(path.join(filePath, 'etags')).toString());
|
||||
|
||||
@@ -5,7 +5,7 @@ import { STATUS } from '@hydrooj/utils/lib/status';
|
||||
import { check, compileChecker } from '../check';
|
||||
import compile from '../compile';
|
||||
import { getConfig } from '../config';
|
||||
import { CompileError, SystemError } from '../error';
|
||||
import { CompileError, FormatError } from '../error';
|
||||
import { run } from '../sandbox';
|
||||
import signals from '../signals';
|
||||
import { parseFilename } from '../utils';
|
||||
@@ -134,7 +134,7 @@ function judgeSubtask(subtask, sid: string) {
|
||||
}
|
||||
|
||||
export const judge = async (ctx) => {
|
||||
if (!ctx.config.subtasks.length) throw new SystemError('Problem data not found.');
|
||||
if (!ctx.config.subtasks.length) throw new FormatError('Problem data not found.');
|
||||
ctx.next({ status: STATUS.STATUS_COMPILING });
|
||||
if (ctx.config.template) {
|
||||
if (ctx.config.template[ctx.lang]) {
|
||||
|
||||
@@ -95,7 +95,7 @@ export const judge = async (ctx) => {
|
||||
status,
|
||||
time_ms: time_usage_ms,
|
||||
memory_kb: memory_usage_kb,
|
||||
message: message.join('\n').substr(0, 1024000),
|
||||
message: message.join('\n').substr(0, 102400),
|
||||
},
|
||||
});
|
||||
ctx.stat.done = new Date();
|
||||
|
||||
@@ -76,7 +76,7 @@ async function postInit() {
|
||||
async function cacheOpen(source: string, files: any[]) {
|
||||
const filePath = path.join(getConfig('cache_dir'), source);
|
||||
await fs.ensureDir(filePath);
|
||||
if (!files?.length) throw new SystemError('Problem data not found.');
|
||||
if (!files?.length) throw new FormatError('Problem data not found.');
|
||||
let etags: Record<string, string> = {};
|
||||
try {
|
||||
etags = JSON.parse(fs.readFileSync(path.join(filePath, 'etags')).toString());
|
||||
|
||||
Reference in new issue
Block a user