mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 18:08:42 +00:00
feat(remote_judger/loj): compile error message
This commit is contained in:
parent
9bad6f6ec7
commit
72242edbfc
@ -1,8 +1,10 @@
|
|||||||
import superagent from 'superagent';
|
import superagent from 'superagent';
|
||||||
import proxy from 'superagent-proxy';
|
import proxy from 'superagent-proxy';
|
||||||
|
import { stripVTControlCharacters } from 'util';
|
||||||
import sleep from '../utils/sleep';
|
import sleep from '../utils/sleep';
|
||||||
import { IBasicProvider, RemoteAccount, USER_AGENT } from '../interface';
|
import { IBasicProvider, RemoteAccount, USER_AGENT } from '../interface';
|
||||||
import Logger from '../utils/logger';
|
import Logger from '../utils/logger';
|
||||||
|
import { normalize, VERDICT } from '../verdict';
|
||||||
|
|
||||||
proxy(superagent);
|
proxy(superagent);
|
||||||
const logger = new Logger('remote/loj');
|
const logger = new Logger('remote/loj');
|
||||||
@ -261,38 +263,43 @@ export default class LibreojProvider implements IBasicProvider {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await sleep(2000);
|
await sleep(1000);
|
||||||
const { body, error } = await this.post('/submission/getSubmissionDetail')
|
const { body, error } = await this.post('/submission/getSubmissionDetail')
|
||||||
.send({ submissionId: String(id), locale: 'zh_CN' })
|
.send({ submissionId: String(id), locale: 'zh_CN' })
|
||||||
.retry(3);
|
.retry(3);
|
||||||
|
|
||||||
if (error) continue;
|
if (error) continue;
|
||||||
|
|
||||||
if (body.progress.progressType !== 'Finished') {
|
await next({
|
||||||
await next({
|
status: `${body.progress.progressType}`,
|
||||||
status: `${body.progress.progressType}`,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
if (body.progress.progressType !== 'Finished') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.meta.status === 'CompilationError') {
|
const status =
|
||||||
|
VERDICT[
|
||||||
|
Object.keys(VERDICT).find(k =>
|
||||||
|
normalize(body.meta.status).includes(k)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
if (status === 'Compile Error') {
|
||||||
await end({
|
await end({
|
||||||
error: true,
|
error: true,
|
||||||
id,
|
id,
|
||||||
status: 'Compile Error',
|
status: 'Compile Error',
|
||||||
|
message: stripVTControlCharacters(body.progress.compile.message),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (status === 'Judgment Failed') {
|
||||||
['SystemError', 'JudgementFailed', 'ConfigurationError'].includes(
|
|
||||||
body.meta.status
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
await end({
|
await end({
|
||||||
error: true,
|
error: true,
|
||||||
id,
|
id,
|
||||||
status: 'Judgment Failed',
|
status: 'Judgment Failed',
|
||||||
|
message: 'Error occurred on remote online judge.',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,20 @@ export const VERDICT = new Proxy<Record<string, string>>(
|
|||||||
|
|
||||||
// Codeforces
|
// Codeforces
|
||||||
'HAPPY_NEW_YEAR!': 'Accepted',
|
'HAPPY_NEW_YEAR!': 'Accepted',
|
||||||
|
|
||||||
|
// LibreOJ
|
||||||
|
COMPILATIONERROR: 'Compile Error',
|
||||||
|
COMPILEERROR: 'Compile Error',
|
||||||
|
FILEERROR: 'File Error',
|
||||||
|
RUNTIMEERROR: 'Runtime Error',
|
||||||
|
TIMELIMITEXCEEDED: 'Time Limit Exceeded',
|
||||||
|
MEMORYLIMITEXCEEDED: 'Memory Limit Exceeded',
|
||||||
|
OUTPUTLIMITEXCEEDED: 'Output Limit Exceeded',
|
||||||
|
WRONGANSWER: 'Wrong Answer',
|
||||||
|
PARTIALLYCORRECT: 'Partially Correct',
|
||||||
|
JUDGEMENTFAILED: 'Judgment Failed',
|
||||||
|
SYSTEMERROR: 'Judgment Failed',
|
||||||
|
CONFIGURATIONERROR: 'Judgment Failed',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
get(self, key) {
|
get(self, key) {
|
||||||
|
Loading…
Reference in New Issue
Block a user