mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: update types
This commit is contained in:
1 parent
a2bbb7a0e3
commit
14e0bebe79
3 files changed
+5
-4
No files matched your search
@@ -508,7 +508,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
throw new BadRequestError('Language not allowed.');
|
||||
}
|
||||
if (pretest) {
|
||||
if (setting.langs[lang]?.pretest) lang = setting.langs[lang].pretest;
|
||||
if (setting.langs[lang]?.pretest) lang = setting.langs[lang].pretest as string;
|
||||
if (setting.langs[lang]?.pretest === false) throw new BadRequestError('Cannot run pretest for this language.');
|
||||
if (!['default', 'fileio', 'remote_judge'].includes(this.response.body.pdoc.config?.type)) {
|
||||
throw new BadRequestError('unable to run pretest');
|
||||
|
||||
@@ -277,8 +277,8 @@ async function handle(ctx: KoaContext, HandlerClass, checker) {
|
||||
}
|
||||
} catch (e) {
|
||||
try {
|
||||
await bail(`handler/error/${HandlerClass.name.replace(/Handler$/, '')}`, h, e);
|
||||
await bail('handler/error', h, e);
|
||||
await serial(`handler/error/${HandlerClass.name.replace(/Handler$/, '')}`, h, e);
|
||||
await serial('handler/error', h, e);
|
||||
await h.onerror(e);
|
||||
} catch (err) {
|
||||
h.response.code = 500;
|
||||
|
||||
@@ -14,7 +14,8 @@ export interface LangConfig {
|
||||
hidden: boolean;
|
||||
analysis?: string;
|
||||
remote?: string;
|
||||
pretest?: string;
|
||||
pretest?: string | false;
|
||||
comment?: string | [string, string];
|
||||
}
|
||||
|
||||
export function parseLang(config: string): Record<string, LangConfig> {
|
||||
|
||||
Reference in new issue
Block a user