vjudge: throw error when codeforces not available

This commit is contained in:
undefined committed 2021-09-27 09:02:56 +08:00
1 parent 3f2c6625a2
commit 69f84b4a28
2 files changed
+5 -2

No files matched your search

@@ -73,6 +73,9 @@ export default class CodeforcesProvider implements IBasicProvider {
this.cookie = header['set-cookie'];
}
const $dom = new JSDOM(html);
if ($dom.window.document.body.children.length < 2 && html.length < 1000) {
throw new Error($dom.window.document.body.textContent);
}
return $dom.window.document.querySelector('meta[name="X-Csrf-Token"]').getAttribute('content');
}