mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
vjudge: luogu: parse errormsg
This commit is contained in:
1 file changed
+24
-9
@@ -100,15 +100,30 @@ export default class LuoguProvider extends BasicFetcher implements IBasicProvide
|
|||||||
lang = lang.slice(0, -2);
|
lang = lang.slice(0, -2);
|
||||||
}
|
}
|
||||||
lang = lang.split('luogu.')[1];
|
lang = lang.split('luogu.')[1];
|
||||||
const result = await this.post(`/fe/api/problem/submit/${id}${this.account.query || ''}`)
|
try {
|
||||||
.set('referer', `https://www.luogu.com.cn/problem/${id}`)
|
const result = await this.post(`/fe/api/problem/submit/${id}${this.account.query || ''}`)
|
||||||
.send({
|
.set('referer', `https://www.luogu.com.cn/problem/${id}`)
|
||||||
code,
|
.send({
|
||||||
lang: +lang,
|
code,
|
||||||
enableO2,
|
lang: +lang,
|
||||||
});
|
enableO2,
|
||||||
logger.info('RecordID:', result.body.rid);
|
});
|
||||||
return result.body.rid;
|
logger.info('RecordID:', result.body.rid);
|
||||||
|
return result.body.rid;
|
||||||
|
} catch (e) {
|
||||||
|
let parsed = e;
|
||||||
|
if (e.text) {
|
||||||
|
try {
|
||||||
|
const message = JSON.parse(e.text).errorMessage;
|
||||||
|
if (!message) throw e;
|
||||||
|
parsed = new Error(message);
|
||||||
|
parsed.stack = e.stack;
|
||||||
|
} catch (err) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw parsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForSubmission(id: string, next, end) {
|
async waitForSubmission(id: string, next, end) {
|
||||||
|
|||||||
Reference in new issue
Block a user