Clarify notification worker app dependency
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user