judge: throw FormatError when problem data not found

This commit is contained in:
undefined committed 2021-12-11 15:52:13 +08:00
1 parent 785dcc1628
commit 00402f2782
5 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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());
+2 -2
View File
@@ -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]) {
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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());