1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-11 05:53:42 +00:00

Handle Unix Not Found Error

This commit is contained in:
Justin Baur
2025-01-29 09:10:28 -05:00
parent b07d6c29a4
commit 7994e8a7fc

View File

@@ -5,6 +5,10 @@ import { ipcMain } from "electron";
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";
export class DesktopCredentialStorageListener {
constructor(
private serviceName: string,
@@ -36,12 +40,16 @@ export class DesktopCredentialStorageListener {
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(
`Error while event in the keytar action: ${message?.action ?? "Unknown action"}`,
e,
);
}
});
}