fix: handle case where message id may not exist

This commit is contained in:
2024-09-13 11:59:14 -04:00
parent 192d89ae3b
commit 71799e4ae8
2 changed files with 9 additions and 4 deletions

View File

@@ -99,8 +99,10 @@ app.openapi(route, async (c) => {
env<Env, typeof c>(c, "workerd"),
titleId,
);
await client.messages.delete(messageId);
await deleteTitleMessage(env<Env, typeof c>(c, "workerd"), titleId);
if (messageId) {
await client.messages.delete(messageId);
await deleteTitleMessage(env<Env, typeof c>(c, "workerd"), titleId);
}
}
} catch (error) {
console.error(new Error("Error setting watch status", { cause: error }));