Clarify notification worker app dependency

This commit is contained in:
zv
2026-06-12 21:18:56 +02:00
parent 487a480bbd
commit ea1dd4b5cb
3 changed files with 17 additions and 3 deletions

View File

@@ -55,6 +55,17 @@ async function callNotificationEndpoint(path) {
return body;
}
function formatWorkerError(error) {
if (error?.cause?.code === "ECONNREFUSED") {
return [
`wtr. notification worker: app is not reachable at ${appUrl}.`,
"Start the Next.js app first with `npm run start`, or set WTR_APP_URL to the running app URL.",
].join(" ");
}
if (error instanceof Error) return error.message;
return String(error);
}
async function tick() {
if (isRunningTick) return;
isRunningTick = true;
@@ -72,7 +83,7 @@ async function tick() {
lastMorningBriefDate = warsawTime.dateKey;
}
} catch (error) {
console.error(error);
console.error(formatWorkerError(error));
} finally {
isRunningTick = false;
}