summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2022-12-28 11:32:53 +0100
committerNeal H. Walfield <neal@pep.foundation>2023-01-06 13:24:55 +0100
commit7ae1dfc5bb52437cc384efb9a6c17d24642c9aa7 (patch)
treec8c96f9fc2ebc33891dab31e6efe8a386191830c
parent6292912a80fa4ffb9e21b939eca6c33ad9ae4499 (diff)
openpgp: Better handle multiple errors.
- When `CertParser::next` encounters an error reading the next packet, and then encounters an error creating the queued certificate, queue the second error, and return the first one.
-rw-r--r--openpgp/src/cert/parser/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/openpgp/src/cert/parser/mod.rs b/openpgp/src/cert/parser/mod.rs
index 2895df29..3657c7d6 100644
--- a/openpgp/src/cert/parser/mod.rs
+++ b/openpgp/src/cert/parser/mod.rs
@@ -1009,7 +1009,10 @@ impl<'a> Iterator for CertParser<'a> {
Ok(None) => {
return Some(Err(err));
}
- Err(err) => {
+ Err(err2) => {
+ // Return the first error,
+ // queue the second error.
+ self.queued_error = Some(err2);
return Some(Err(err));
}
}