fix(monero wallet): Check if wallet already exists by JsonRpcError Error Code

This commit is contained in:
Binarybaron 2025-05-26 19:02:17 +02:00
parent e1a053a6fc
commit 80ea9a60a9

View file

@ -152,7 +152,8 @@ impl Wallet {
// we just try to open it instead // we just try to open it instead
match result { match result {
Ok(_) => Ok(()), Ok(_) => Ok(()),
Err(error) if error.to_string().contains("Wallet already exists") => { // See: https://github.com/monero-project/monero/blob/master/src/wallet/wallet_rpc_server_error_codes.h#L54
Err(jsonrpc::Error::JsonRpc(jsonrpc::JsonRpcError { code: -21, .. })) => {
tracing::debug!( tracing::debug!(
monero_wallet_name = &file_name, monero_wallet_name = &file_name,
"Cannot create wallet because it already exists, loading instead" "Cannot create wallet because it already exists, loading instead"