Skip to content

Commit

Permalink
SM-1174: Print an error if state file cannot be retrieved, and contin…
Browse files Browse the repository at this point in the history
…ue to attempt program execution
  • Loading branch information
coltonhurst committed Aug 5, 2024
1 parent 1b30f4e commit c520d1f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/bws/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,16 @@ async fn process_commands() -> Result<()> {

let state_file = match get_state_opt_out(&profile) {
true => None,
false => Some(state::get_state_file(
false => match state::get_state_file(
profile.and_then(|p| p.state_dir).map(Into::into),
access_token_obj.access_token_id.to_string(),
)?),
) {
Ok(state_file) => Some(state_file),
Err(e) => {
eprintln!("Error: {}\nAttempting to continue without using state. Please set \"state_dir\" in your config file to avoid authentication limits.", e);
None

Check warning on line 98 in crates/bws/src/main.rs

View check run for this annotation

Codecov / codecov/patch

crates/bws/src/main.rs#L89-L98

Added lines #L89 - L98 were not covered by tests
}
},
};

let client = bitwarden::Client::new(settings);
Expand Down

0 comments on commit c520d1f

Please sign in to comment.