azerpas / bourso-api

Boursorama / BoursoBank unofficial API and CLI
MIT License
18 stars 2 forks source link

Panic on bourso accounts #32

Closed delthas closed 3 months ago

delthas commented 3 months ago

Hi, I just cloned master, ran bourso config (successfully), then ran bourso accounts. Getting a panic. Logs:

$ RUST_BACKTRACE=1 cargo run accounts

 INFO  bourso_cli > Welcome to BoursoBank CLI 👋
 INFO  bourso_cli > ℹ️ - Version 0.1.4. Make sure you're running the latest version: https://github.com/azerpas/bourso-api

 INFO  bourso_cli > We'll try to log you in with your customer id: xxxxxxxx
 INFO  bourso_cli > If you want to change it, run `bourso config --username <customer_id>`

 INFO  bourso_cli > We'll need your password to log you in. It will not be stored anywhere and will be asked everytime you run a command. The password will be hidden while typing.
Enter your password: 
 INFO  bourso_api::client > 🔓 You are now logged in with user: xxxxxxxxxxxxxxx
thread 'main' panicked at src/bourso_api/src/client/account.rs:61:10:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::unwrap_failed
   4: core::option::Option<T>::unwrap
             at /usr/src/debug/rust/rustc-1.77.1-src/library/core/src/option.rs:931:21
   5: bourso_api::client::account::extract_accounts
             at ./src/bourso_api/src/client/account.rs:59:23
   6: bourso_api::client::account::<impl bourso_api::client::BoursoWebClient>::get_accounts::{{closure}}
             at ./src/bourso_api/src/client/account.rs:41:21
   7: bourso_cli::parse_matches::{{closure}}
             at ./src/lib.rs:112:58
   8: bourso_cli::main::{{closure}}
             at ./src/main.rs:180:40
   9: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/park.rs:282:63
  10: tokio::runtime::coop::with_budget
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/coop.rs:107:5
  11: tokio::runtime::coop::budget
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/coop.rs:73:5
  12: tokio::runtime::park::CachedParkThread::block_on
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/park.rs:282:31
  13: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/context/blocking.rs:66:9
  14: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/scheduler/multi_thread/mod.rs:87:13
  15: tokio::runtime::context::runtime::enter_runtime
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/context/runtime.rs:65:16
  16: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
  17: tokio::runtime::runtime::Runtime::block_on
             at .cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.33.0/src/runtime/runtime.rs:350:45
  18: bourso_cli::main
             at ./src/main.rs:182:5
  19: core::ops::function::FnOnce::call_once
             at /usr/src/debug/rust/rustc-1.77.1-src/library/core/src/ops/function.rs:250:5
azerpas commented 3 months ago

Hi @delthas,

At first glance it appears that the issue arises because the tool attempts to retrieve all possible types of accounts (Loans, Savings, etc...), regardless of whether you possess such accounts, leading to errors when they are not found.

The latest release 0.1.6, should solve this with introducing enhanced logging to provide more information in case the issue persists.

Please let me know if this fixes it for you.