fix(mobile): record xprem_js_crash only for fatal JS errors

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jjbruntonandClaude Fable 5 committed 2026-08-31 11:13:55 +01:00
1 parent 659cee76b6
commit 5c4a4608b1
2 files changed
+29 -12

No files matched your search

+12 -9
View File
@@ -50,15 +50,18 @@ export function installObserveGlobalErrorHandler() {
const previousHandler = errorUtils.getGlobalHandler();
errorUtils.setGlobalHandler((error, isFatal) => {
try {
const message = error instanceof Error ? error.message : String(error);
Observe.logEvent("xprem_js_crash", {
severity: "fatal",
body: message,
attributes: { isFatal: Boolean(isFatal) },
});
} catch (observeError) {
console.warn("[Observe] Failed to log xprem_js_crash:", observeError);
// Only fatal errors count as a crash; non-fatal handled errors would
// otherwise skew update-health tracking.
if (isFatal) {
try {
const message = error instanceof Error ? error.message : String(error);
Observe.logEvent("xprem_js_crash", {
severity: "fatal",
body: message,
});
} catch (observeError) {
console.warn("[Observe] Failed to log xprem_js_crash:", observeError);
}
}
previousHandler(error, isFatal);