-
Notifications
You must be signed in to change notification settings - Fork 2
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
migrate error handling to anyhow #26
Conversation
fafa809
to
4068ce3
Compare
Add a new dependency of `anyhow` crate, to use flexible concrete error handling mechanism, instead of the native error types.
4068ce3
to
ae0ce7d
Compare
To follow error handling convention of anyhow, insert `.context` to add detailed message of error context when returning from functions. In case of an immediate error exit, use a `bail!` macro. Note, main functions and unit tests stay untouched if possible.
ae0ce7d
to
44d7530
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some improvements would be good: Instead of writing errors to the terminal from functions that return Options it would be better to return Results.
Also, the dummy signature error is printed too prominently, we skip over it but it looks like the program crashed if you don't pay attention to the last line
Parsed and verified signature data from file "/var/tmp/outdir/.unverified/oem-ami.gz"
which indicates that it was successful.
Doing it in a follow-up is better, thus the approval. |
Thanks. I created a separate issue for the improvement of error handling. #28 |
Update ue-rs to 0.1.0-r4, 2023-12-05. Pulls in flatcar/ue-rs#26, flatcar/ue-rs#29, flatcar/ue-rs#30, flatcar/ue-rs#36, flatcar/ue-rs#37, flatcar/ue-rs#39, flatcar/ue-rs#40.
Add a new dependency of
anyhow
crate, to use flexible concrete error handling mechanism, instead of the native error types.To follow error handling convention of anyhow, insert
.context
to add detailed message of error context when returning from functions.In case of an immediate error exit, use a
bail!
macro.Note, main functions and unit tests stay untouched if possible.
Fixes #25