Skip to content

Commit 68e64bf

Browse files
committed
Enhance error reporting by adding version and build date to error emails. Update EmailTemplate to display version and build date if available. Modify ErrorEmailProps type to include optional version and buildDate fields.
1 parent 32c8cc1 commit 68e64bf

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

apps/roam/src/utils/sendErrorEmail.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getNodeEnv } from "roamjs-components/util/env";
22
import { ErrorEmailProps } from "@repo/types";
3+
import { getVersionWithDate } from "~/utils/getVersion";
34

45
const sendErrorEmail = async ({
56
error,
@@ -14,12 +15,15 @@ const sendErrorEmail = async ({
1415
getNodeEnv() === "development"
1516
? "http://localhost:3000/api/errors"
1617
: "https://discoursegraphs.com/api/errors";
18+
const { version, buildDate } = getVersionWithDate();
1719
const payload: ErrorEmailProps = {
1820
errorMessage: error.message,
1921
errorStack: error.stack || "",
2022
type,
2123
app: "Roam",
2224
graphName: window.roamAlphaAPI?.graph?.name || "unknown",
25+
version,
26+
buildDate,
2327
context,
2428
};
2529

apps/website/app/api/errors/EmailTemplate.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ export const EmailTemplate = ({
88
type,
99
app,
1010
graphName,
11+
version,
12+
buildDate,
1113
context,
1214
}: ErrorEmailProps) => {
1315
return (
1416
<div>
1517
<h1>Error Report</h1>
1618

17-
<h2>Type: {type}</h2>
18-
<h2>App: {app}</h2>
19-
<h2>Graph Name: {graphName}</h2>
19+
<span>Type: {type}</span>
20+
<span>App: {app}</span>
21+
<span>Graph Name: {graphName}</span>
22+
{version && <span>Version: {version}</span>}
23+
{buildDate && <span>Build Date: {buildDate}</span>}
2024

2125
<div>
2226
<h2>Error Details</h2>

packages/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ export type ErrorEmailProps = {
44
type: string; // To identify the type of error, eg "Export Dialog Failed"
55
app: "Roam" | "Obsidian";
66
graphName: string;
7+
version?: string;
8+
buildDate?: string;
79
context?: Record<string, unknown>;
810
};

0 commit comments

Comments
 (0)