mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
vjudge: luogu: parse errormsg
This commit is contained in:
1 file changed
+15
@@ -100,6 +100,7 @@ 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];
|
||||||
|
try {
|
||||||
const result = await this.post(`/fe/api/problem/submit/${id}${this.account.query || ''}`)
|
const result = await this.post(`/fe/api/problem/submit/${id}${this.account.query || ''}`)
|
||||||
.set('referer', `https://www.luogu.com.cn/problem/${id}`)
|
.set('referer', `https://www.luogu.com.cn/problem/${id}`)
|
||||||
.send({
|
.send({
|
||||||
@@ -109,6 +110,20 @@ export default class LuoguProvider extends BasicFetcher implements IBasicProvide
|
|||||||
});
|
});
|
||||||
logger.info('RecordID:', result.body.rid);
|
logger.info('RecordID:', result.body.rid);
|
||||||
return 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