Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): preserve updater failure causes in diagnostics #18864

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/18864/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 112 additions and 3 deletions (loading 1).

x
0 of 2 viewed, 2 left
112 additions and 3 deletionsapps/desktop/src/updates/DesktopUpdates.test.tsModified
View file
@@ -430,9 +430,10 @@
).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));
});
​
- it.effect("logs bounded updater failure context without exposing the cause", () => {
- const cause = new Error(
- "request failed for https://user:secret@example.com/update?token=secret",
+ it.effect("logs the redacted cause of a rejected update check", () => {
+ const cause = Object.assign(
+ new Error("request failed for https://user:secret@example.com/update?token=secret"),
+ { code: "ERR_UPDATER_LATEST_VERSION_NOT_FOUND" },
const updaterError = new ElectronUpdater.ElectronUpdaterCheckForUpdatesError({
channel: null,
@@ -459,6 +460,10 @@
assert.isDefined(loggedAnnotation);
assert.equal(loggedAnnotation.errorTag, "ElectronUpdaterCheckForUpdatesError");
assert.isNull(loggedAnnotation.channel);
+ assert.equal(
+ loggedAnnotation.cause,
+ "Error [ERR_UPDATER_LATEST_VERSION_NOT_FOUND]: request failed for [redacted URL]",
+ );
assert.notProperty(loggedAnnotation, "error");
assert.notInclude(Object.values(loggedAnnotation).map(String).join(" "), "secret");
assert.equal(
@@ -478,6 +483,49 @@
});