Skip to content

Commit

Permalink
Fixing test
Browse files Browse the repository at this point in the history
  • Loading branch information
richajaindce committed Sep 13, 2024
1 parent 9baca44 commit bd65cb5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ipa-core/src/cli/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub async fn decrypt_and_reconstruct(args: DecryptArgs) -> Result<(), BoxError>
.create_new(true)
.open(args.output_file)?,
);
let mut first_error = None;
let mut first_error = Ok(());
for (idx, (dec_report1, (dec_report2, dec_report3))) in decrypted_reports1
.zip(decrypted_reports2.zip(decrypted_reports3))
.enumerate()
Expand Down Expand Up @@ -236,33 +236,33 @@ pub async fn decrypt_and_reconstruct(args: DecryptArgs) -> Result<(), BoxError>
trigger_value,
)?;
}
// error handling in case decryption failed
(Err(e1), _, _) => {
writeln!(writer, "Decryption failed Record: {idx} Reason:{e1}",)?;
eprintln!("Decryption failed Record: {idx} Reason:{e1}");
if first_error.is_none() {
first_error = Some(e1);
if first_error.is_ok() {
first_error = Err(e1);
}
}
(Ok(_), Err(e2), _) => {
writeln!(writer, "Decryption failed Record: {idx} Reason:{e2}",)?;
eprintln!("Decryption failed Record: {idx} Reason:{e2}");
if first_error.is_none() {
first_error = Some(e2);
if first_error.is_ok() {
first_error = Err(e2);
}

Check warning on line 252 in ipa-core/src/cli/crypto.rs

View check run for this annotation

Codecov / codecov/patch

ipa-core/src/cli/crypto.rs#L247-L252

Added lines #L247 - L252 were not covered by tests
}
(Ok(_), Ok(_), Err(e3)) => {
writeln!(writer, "Decryption failed Record: {idx} Reason:{e3}",)?;
eprintln!("Decryption failed Record: {idx} Reason:{e3}");
if first_error.is_none() {
first_error = Some(e3);
if first_error.is_ok() {
first_error = Err(e3);
}

Check warning on line 259 in ipa-core/src/cli/crypto.rs

View check run for this annotation

Codecov / codecov/patch

ipa-core/src/cli/crypto.rs#L254-L259

Added lines #L254 - L259 were not covered by tests
}
}
}
match first_error {
None => Ok(()),
Some(err) => Err(Box::new(err)),
}

first_error.unwrap();
Ok(())
}

#[cfg(test)]
Expand Down

0 comments on commit bd65cb5

Please sign in to comment.