1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { runErrorEmail } from "https://esm.town/v/stevekrouse/runErrorEmail";
import { email } from "https://esm.town/v/std/email?v=9";
import process from "node:process";
import { runs as runs2 } from "https://esm.town/v/stevekrouse/runs";
export const errorNotify = async (interval: Interval) => {
const runs = await runs2({
token: process.env.valtown,
error: true,
source: ["api", "interval", "email"],
since: interval.lastRunAt,
});
if (runs?.data?.length) {
await email({
html: runErrorEmail(runs),
subject: "Val Town Errors",
});
}
return runs;
};