Skip to content

Commit 337ff31

Browse files
committed
Refactor PASSWORD_NOT_FOUND handling to use a centralized source from desktop_core for consistency in error messaging.
1 parent 8a9cbfb commit 337ff31

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

native/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ module.exports = {
7777
isAvailable: () => nativeBinding.isAvailable(),
7878
migrateKeytarPassword: (service, account) =>
7979
nativeBinding.migrateKeytarPassword(service, account),
80-
PASSWORD_NOT_FOUND: "Password not found.",
80+
PASSWORD_NOT_FOUND: nativeBinding.PASSWORD_NOT_FOUND,
8181
},
8282
};

native/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#[macro_use]
22
extern crate napi_derive;
33

4+
/// The error message returned when a password is not found during retrieval or deletion.
5+
/// Re-exported from desktop_core so JS callers have a single authoritative source.
6+
#[napi]
7+
pub const PASSWORD_NOT_FOUND: &str = desktop_core::password::PASSWORD_NOT_FOUND;
48

59
/// Fetch the stored password from the keychain.
610
/// Throws an Error with message PASSWORD_NOT_FOUND if the password does not exist.

0 commit comments

Comments
 (0)