Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Unix Not Found Error #13127

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import { ConsoleLogService } from "@bitwarden/common/platform/services/console-log.service";
import { passwords } from "@bitwarden/desktop-napi";

const WindowsNotFoundError = "Password not found.";
const MacOSNotFoundError = "The specified item could not be found in the keychain.";
const UnixNotFoundError = "no result";

Check warning on line 10 in apps/desktop/src/platform/main/desktop-credential-storage-listener.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/platform/main/desktop-credential-storage-listener.ts#L8-L10

Added lines #L8 - L10 were not covered by tests

export class DesktopCredentialStorageListener {
constructor(
private serviceName: string,
Expand Down Expand Up @@ -36,12 +40,16 @@
return val;
} catch (e) {
if (
e.message === "Password not found." ||
e.message === "The specified item could not be found in the keychain."
e.message === WindowsNotFoundError ||
e.message === MacOSNotFoundError ||
e.message === UnixNotFoundError
) {
return null;
}
this.logService.info(e);
this.logService.warning(

Check warning on line 49 in apps/desktop/src/platform/main/desktop-credential-storage-listener.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/platform/main/desktop-credential-storage-listener.ts#L49

Added line #L49 was not covered by tests
`Error while event in the keytar action: ${message?.action ?? "Unknown action"}`,
e,
);
}
});
}
Expand Down
Loading