core: send: detailed logs

pull/148/head
undefined 3 years ago
parent 0fcbcf4f1a
commit 437bfc5e6e

@ -63,11 +63,11 @@ class ProxySendRequestHandler extends Handler {
let res = await superagent.post(`${url}d/${domainId}/problem/send`)
.send({ operation: 'info', token: tokenId })
.catch((e) => e);
if (res instanceof Error) throw new RemoteOnlineJudgeError(res.message);
if (res instanceof Error) throw new RemoteOnlineJudgeError(`[Post Target/Send/Info] ${res.message}`);
res = await superagent.post(`${endpoint}/problem/receive`).send({
operation: 'request', url: `${url}d/${domainId}/problem/send`, tokenId, expire,
}).catch((e) => e);
if (res instanceof Error) throw new RemoteOnlineJudgeError(res.message);
if (res instanceof Error) throw new RemoteOnlineJudgeError(`[Post Target/Receive/Request] ${res.message}`);
this.response.body = { code: 0 };
}
}

@ -1,6 +1,6 @@
{
"name": "@hydrooj/center",
"version": "0.0.2",
"version": "0.0.3",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",
"author": "undefined <i@undefined.moe>",

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.26.24",
"version": "2.26.25",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",

@ -57,7 +57,7 @@ export class ProblemSendHandler extends Handler {
.send({
operation: 'request', url: `${url}d/${domainId}/problem/send`, tokenId, expire,
}).catch(logAndReturn(logger));
if (res instanceof Error) throw new RemoteOnlineJudgeError(res.message);
if (res instanceof Error) throw new RemoteOnlineJudgeError(`[Post Target/Request] ${res.message}`);
this.back();
}
@ -123,7 +123,7 @@ export class ProblemReceiveHandler extends Handler {
const res = await superagent.post(url)
.send({ operation: 'info', token: tokenId })
.catch(logAndReturn(logger));
if (res instanceof Error) throw new RemoteOnlineJudgeError(res.message);
if (res instanceof Error) throw new RemoteOnlineJudgeError(`[Post Origin/Info] ${res.message}`);
const [id] = await token.add(token.TYPE_IMPORT, expire, {
domainId, tokenId, source: url, pdocs: res.body.pdocs, pids: res.body.pids,
});
@ -154,7 +154,7 @@ export class ProblemReceiveHandler extends Handler {
token: data.tokenId,
pids: filterPid.length ? filterPid.map((i) => (+i ? +i : i)) : data.pids,
}).catch(logAndReturn(logger));
if (res instanceof Error) throw new RemoteOnlineJudgeError(res.message);
if (res instanceof Error) throw new RemoteOnlineJudgeError(`[Post Origin/Fetch] ${res.message}`);
const pids = [];
const { pdocs } = res.body;
const files = res.body.links;

Loading…
Cancel
Save