Skip to content

Commit

Permalink
review fix: add note about ok_or usage for Constructible
Browse files Browse the repository at this point in the history
  • Loading branch information
shamardy committed Sep 19, 2024
1 parent f4162b8 commit 704305d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mm2src/mm2_main/src/lp_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ impl From<WalletsDBError> for GetWalletsError {
/// Retrieves all created wallets and the currently activated wallet.
pub async fn get_wallet_names_rpc(ctx: MmArc, _req: Json) -> MmResult<GetWalletNamesResponse, GetWalletsError> {
let wallets = read_all_wallet_names(&ctx).await?;
// Note: `ok_or` is used here on `Constructible<Option<String>>` to handle the case where the wallet name is not set.
// `wallet_name` can be `None` in the case of no-login mode.
let activated_wallet = ctx.wallet_name.ok_or(GetWalletsError::Internal(
"`wallet_name` not initialized yet!".to_string(),
))?;
Expand Down

0 comments on commit 704305d

Please sign in to comment.