hydrojudge intergration

This commit is contained in:
undefined committed 2020-08-09 19:02:03 +08:00
1 parent 2a09213f5d
commit 6b88570bd6
24 files changed
+1719 -9

No files matched your search

+69
View File
@@ -0,0 +1,69 @@
import { STATUS_TEXTS } from 'hydrooj/dist/model/builtin';
export class CompileError extends Error {
stdout: string;
stderr: string;
status: string;
type: string;
constructor(obj) {
super('Compile Error');
if (typeof obj === 'string') {
this.stdout = obj;
this.stderr = '';
} else {
this.stdout = obj.stdout || '';
this.stderr = obj.stderr || '';
this.status = obj.status ? STATUS_TEXTS[obj.status] || '' : '';
}
this.type = 'CompileError';
}
}
export class FormatError extends Error {
type: string;
params: any[];
constructor(message, params = []) {
super(message);
this.type = 'FormatError';
this.params = params;
}
}
export class RuntimeError extends Error {
type: string;
detail: any;
constructor(detail, message) {
super(message);
this.type = 'RuntimeError';
this.detail = detail;
}
}
export class SystemError extends Error {
type: string;
params: any[];
constructor(message: string, params = []) {
super(message);
this.type = 'SystemError';
this.params = params;
}
}
export class TooFrequentError extends Error {
type: string;
constructor(message: string) {
super(message);
this.type = 'TooFrequentError';
}
}