chore: audit frontend error reporting to exclude expected behaviours
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 59s
CI / Lint, Build & Test (pull_request) Successful in 1m13s

Closes #73
This commit is contained in:
2026-03-19 15:56:32 -07:00
committed by Naomi Carrigan
parent a8a465f293
commit cc28f05c67
+28 -20
View File
@@ -1224,9 +1224,12 @@ export const GameProvider = ({
) {
signatureReference.current = null;
localStorage.removeItem("elysium_save_signature");
} else {
logError("auto_save", error_);
}
/*
* Network failures during background auto-save are expected on
* flaky connections — the next tick will retry, so no telemetry needed
*/
});
}
}
@@ -1254,10 +1257,9 @@ export const GameProvider = ({
}
await reloadReference.current();
}).
catch((error_: unknown) => {
logError("auto_prestige", error_);
catch(() => {
/* Silently ignore — will retry next tick */
/* Silently ignore — eligibility is re-checked every tick */
}).
finally(() => {
isAutoPrestigingReference.current = false;
@@ -1307,11 +1309,18 @@ export const GameProvider = ({
});
}).
catch((error_: unknown) => {
logError("auto_boss", error_);
const message
= error_ instanceof Error
? error_.message
: String(error_);
/*
* "Boss is not currently available" is an expected race condition
* in the tick loop — suppress telemetry for this case only
*/
if (message !== "Boss is not currently available") {
logError("auto_boss", error_);
}
setAutoBossError(message);
setState((previous) => {
if (previous === null) {
@@ -1709,7 +1718,6 @@ export const GameProvider = ({
}, []);
const startExploration = useCallback(async(areaId: string) => {
try {
const response = await startExplorationApi({ areaId });
setState((previous) => {
if (previous?.exploration === undefined) {
@@ -1731,15 +1739,10 @@ export const GameProvider = ({
},
};
});
} catch (error_: unknown) {
logError("start_exploration", error_);
throw error_;
}
}, []);
const collectExploration = useCallback(
async(areaId: string): Promise<ExploreCollectResponse> => {
try {
const result = await collectExplorationApi({ areaId });
setState((previous) => {
if (previous?.exploration === undefined) {
@@ -1813,10 +1816,6 @@ export const GameProvider = ({
};
});
return result;
} catch (error_: unknown) {
logError("collect_exploration", error_);
throw error_;
}
},
[],
);
@@ -1960,11 +1959,20 @@ export const GameProvider = ({
});
setBattleResult({ bossName: boss.name, result: result });
} catch (error_: unknown) {
logError("challenge_boss", error_);
setBossError(
error_ instanceof Error
const bossErrorMessage
= error_ instanceof Error
? error_.message
: "Failed to challenge boss",
: "Failed to challenge boss";
/*
* "Boss is not currently available" is an expected server rejection
* (race condition between UI state and server state) — suppress telemetry
*/
if (bossErrorMessage !== "Boss is not currently available") {
logError("challenge_boss", error_);
}
setBossError(
bossErrorMessage,
);
}
}, [ forceSync ]);