1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { prepareRunErrorsEmail } from "https://esm.town/v/andreterron/prepareRunErrorsEmail";
import process from "node:process";
import { runs as runs2 } from "https://esm.town/v/stevekrouse/runs?v=17";
export const myRunsFailed = async (interval: Interval) => {
// If the interval never ran, there's no time range to check for updates
if (!interval.lastRunAt) {
return;
}
const runs = await runs2({
token: process.env.vt_token,
error: true,
source: ["api", "interval"],
since: interval.lastRunAt,
});
if (runs?.data?.length ?? 0 > 0) {
console.email({
html: prepareRunErrorsEmail(runs.data),
}, "Your val executions resulted in errors");
}
return runs;
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023