Skip to content

Commit

Permalink
Print a more meaningful message when decoding an object fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
partim committed Jan 16, 2024
1 parent ca3076b commit 35e3406
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,10 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
Ok(manifest) => manifest,
Err(err) => {

Check failure on line 821 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `err`

Check warning on line 821 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

unused variable: `err`
self.metrics.invalid_manifests += 1;
warn!("{}: {}.", self.cert.rpki_manifest(), err);
warn!(
"{}: failed to decode manifest.",
self.cert.rpki_manifest()
);
return Ok(None)
}
};
Expand Down Expand Up @@ -947,7 +950,7 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
Ok(crl) => crl,
Err(err) => {

Check failure on line 951 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `err`

Check warning on line 951 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

unused variable: `err`
self.metrics.invalid_crls += 1;
warn!("{}: {}.", crl_uri, err);
warn!("{}: failed to decode CRL.", crl_uri);
return Ok(None)
}
};
Expand Down Expand Up @@ -1078,8 +1081,11 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
) {
Ok(manifest) => manifest,
Err(err) => {

Check failure on line 1083 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `err`

Check warning on line 1083 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

unused variable: `err`
warn!("{}: {}.", self.cert.rpki_manifest(), err);
self.metrics.invalid_manifests += 1;
warn!(
"{}: failed to decode manifest.",
self.cert.rpki_manifest(),
);
return Err(Failed);
}
};
Expand Down Expand Up @@ -1126,9 +1132,9 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
let mut crl = match Crl::decode(stored_manifest.crl().clone()) {
Ok(crl) => crl,
Err(err) => {

Check failure on line 1134 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `err`

Check warning on line 1134 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

unused variable: `err`
warn!("{}: {}.", crl_uri, err);
self.metrics.invalid_manifests += 1;
self.metrics.invalid_crls += 1;
warn!("{}: failed to decode CRL.", crl_uri);
return Err(Failed)
}
};
Expand Down Expand Up @@ -1272,8 +1278,8 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
let cert = match Cert::decode(content) {
Ok(cert) => cert,
Err(err) => {

Check failure on line 1280 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `err`

Check warning on line 1280 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

unused variable: `err`
warn!("{}: {}.", uri, err);
manifest.metrics.invalid_certs += 1;
warn!("{}: failed to decode certificate.", uri);
return Ok(())
}
};
Expand Down Expand Up @@ -1387,8 +1393,8 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
) {
Ok(roa) => roa,
Err(err) => {

Check failure on line 1395 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `err`

Check warning on line 1395 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

unused variable: `err`
warn!("{}: {}.", uri, err);
manifest.metrics.invalid_roas += 1;
warn!("{}: failed to decode ROA.", uri);
return Ok(())
}
};
Expand Down Expand Up @@ -1421,8 +1427,8 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
) {
Ok(aspa) => aspa,
Err(err) => {
warn!("{}: {}.", uri, err);
manifest.metrics.invalid_aspas += 1;
warn!("{}: failed to decode ASPA.", uri);
return Ok(())
}
};
Expand Down Expand Up @@ -1454,8 +1460,8 @@ impl<'a, P: ProcessRun> PubPoint<'a, P> {
) {
Ok(obj) => obj,
Err(err) => {

Check failure on line 1462 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, stable)

unused variable: `err`

Check warning on line 1462 in src/engine.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, beta)

unused variable: `err`
warn!("{}: {}.", uri, err);
manifest.metrics.invalid_gbrs += 1;
warn!("{}: failed to decode GBR.", uri);
return Ok(())
}
};
Expand Down

0 comments on commit 35e3406

Please sign in to comment.