Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle measurement mismatch errors, add debug logging #91

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

DJAndries
Copy link
Collaborator

To debug issues with the express cron

@DJAndries DJAndries requested a review from a team as a code owner November 21, 2023 21:38
})
match pms.iter().find(|v| v.is_ok()) {
None => {
let first_error = pms.iter().next().unwrap().clone().unwrap_err();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] expect or unwrap called in function returning a Result

Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result


Cc @thypon @bcaller

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes there's at least one element in pms. Something like

let first_error = pms.first().unwrap_or(&...).

Err(AppSTARError::Recovery(first_error))
}
Some(measurement) => Ok(MsgRecoveryInfo {
measurement: get_measurement_contents(measurement.as_ref().unwrap())?,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] expect or unwrap called in function returning a Result

Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result


Cc @thypon @bcaller

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unwrap here isn't new, but this could be measurement.as_ref().map_err(|e| e.to_owned())? or similar?

@DJAndries DJAndries merged commit 889d4d9 into master Nov 21, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants