Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Log failed coconut requests
  • Loading branch information
regalijan committed Mar 26, 2024
1 parent c9c4cd5 commit d5fa259
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion functions/api/reports/complete.ts
Expand Up @@ -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}`);
}

Expand Down

0 comments on commit d5fa259

Please sign in to comment.