Skip to content

Commit 645347c

Browse files
authored
Add email error tracking for tlstore init failure (#486)
1 parent a69b94e commit 645347c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

apps/roam/src/components/canvas/useRoamStore.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
import { AddPullWatch } from "roamjs-components/types";
2727
import { LEGACY_SCHEMA } from "~/data/legacyTldrawSchema";
2828
import sendErrorEmail from "~/utils/sendErrorEmail";
29+
import getCurrentUserDisplayName from "roamjs-components/queries/getCurrentUserDisplayName";
2930

3031
const THROTTLE = 350;
3132

@@ -141,8 +142,18 @@ export const useRoamStore = ({
141142
shapeUtils: [...defaultShapeUtils, ...customShapeUtils],
142143
bindingUtils: [...defaultBindingUtils, ...customBindingUtils],
143144
});
144-
} catch (error) {
145+
} catch (e) {
146+
const error = e as Error;
145147
console.error("Failed to create store:", error);
148+
sendErrorEmail({
149+
error,
150+
type: "Failed to create TLStore",
151+
context: {
152+
pageUid,
153+
user: getCurrentUserDisplayName(),
154+
initialSnapshot,
155+
},
156+
}).catch(() => {});
146157
return null;
147158
}
148159

0 commit comments

Comments
 (0)