pyth2wormhole-client: make sure we raise batch errors on exit

commit-id:65022128
This commit is contained in:
Stan Drozd 2022-02-24 12:48:35 +01:00 committed by Stanisław Drozd
parent d4b7dbf98b
commit 1e953e637f
1 changed files with 13 additions and 2 deletions

View File

@ -268,6 +268,8 @@ fn handle_attest(
batch_count
);
let mut errors = Vec::new();
for (idx, symbols) in attestation_cfg
.symbols
.as_slice()
@ -395,17 +397,26 @@ fn handle_attest(
info!("Batch {}/{}: OK, seqno {}", batch_no, batch_count, seqno);
}
Err(e) => {
error!(
let msg = format!(
"Batch {}/{} tx error: {}",
batch_no,
batch_count,
e.to_string()
);
error!("{}", &msg);
errors.push(msg)
}
}
}
Ok(())
if errors.len() > 0 {
let err_list = errors.join("\n");
Err(format!("{} of {} batches failed:\n{}", errors.len(), batch_count, err_list).into())
} else {
Ok(())
}
}
fn init_logging(verbosity: u32) {