fix: improve error handling across Rust and TypeScript
- Log swallowed errors in file watcher and window operations (lib.rs, watcher.rs) - Propagate recovery errors from bridge::recover_pending to SyncResult.errors so the frontend can display them instead of silently dropping failures - Fix useTauriEvent/useTauriEvents race condition where cleanup fires before async listen() resolves, leaking the listener (cancelled flag pattern) - Guard computeStaleness against invalid date strings (NaN -> 'normal' instead of incorrectly returning 'urgent') - Strengthen isMcError type guard to check field types, not just presence - Log warning when data directory resolution falls back to '.' (state.rs, bridge.rs) - Add test for computeStaleness with invalid date inputs
This commit is contained in:
@@ -31,6 +31,12 @@ describe("computeStaleness", () => {
|
||||
).toISOString();
|
||||
expect(computeStaleness(tenDaysAgo)).toBe("urgent");
|
||||
});
|
||||
|
||||
it("returns 'normal' for invalid date strings instead of 'urgent'", () => {
|
||||
expect(computeStaleness("not-a-date")).toBe("normal");
|
||||
expect(computeStaleness("")).toBe("normal");
|
||||
expect(computeStaleness("2026-13-99T99:99:99Z")).toBe("normal");
|
||||
});
|
||||
});
|
||||
|
||||
describe("isMcError", () => {
|
||||
|
||||
Reference in New Issue
Block a user