Log failed coconut requests
This commit is contained in:
parent
c9c4cd5af4
commit
d5fa2593c0
@ -83,7 +83,19 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.allSettled(responsePromises);
|
const resolvedPromises = await Promise.allSettled(responsePromises);
|
||||||
|
|
||||||
|
for (const p of resolvedPromises) {
|
||||||
|
if (p.status === "rejected")
|
||||||
|
console.log(`Request to coconut failed: ${p}`);
|
||||||
|
else {
|
||||||
|
if (!p.value?.ok)
|
||||||
|
console.log(
|
||||||
|
`Request rejected by coconut: ${await (p.value as Response).text()}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await context.env.DATA.delete(`coconutdata_${id}`);
|
await context.env.DATA.delete(`coconutdata_${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user