Skip to content

Commit

Permalink
fix error message for association state in xdbg (#1496)
Browse files Browse the repository at this point in the history
* fix error message for association state
  • Loading branch information
insipx authored Jan 13, 2025
1 parent 121a788 commit d25351a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions xmtp_debug/src/app/generate/identity.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::sync::Arc;
use std::{collections::HashSet, sync::Arc};

use crate::app::store::{Database, IdentityStore};
use crate::app::{self, types::Identity};
use crate::args;

use color_eyre::eyre::{self, ensure, Result};
use color_eyre::eyre::{self, bail, Result};
use indicatif::{ProgressBar, ProgressStyle};

/// Identity Generation
Expand Down Expand Up @@ -128,8 +128,19 @@ impl GenerateIdentity {
total_states = states.len(),
"ensuring identities registered & latest association state loaded..."
);
for state in states.into_iter() {
ensure!(state.is_ok())
let errs = states
.into_iter()
.filter_map(|s| s.err())
.map(|e| e.to_string())
.collect::<Vec<String>>();
let unique: HashSet<String> = HashSet::from_iter(errs.clone());
if !unique.is_empty() {
tracing::error!("{} errors during identity generation", errs.len());
tracing::error!("{} unique errors during identity generation", unique.len());
for err in unique.into_iter() {
error!(err);
}
bail!("Error generation failed");
}
Ok(identities)
}
Expand Down

0 comments on commit d25351a

Please sign in to comment.