Skip to content

Remove anyhow from the library API & simplify load_root_cert#79

Merged
flihp merged 1 commit into
oxidecomputer:mainfrom
flihp:no-anyhow-in-lib
Jul 23, 2025
Merged

Remove anyhow from the library API & simplify load_root_cert#79
flihp merged 1 commit into
oxidecomputer:mainfrom
flihp:no-anyhow-in-lib

Conversation

@flihp

@flihp flihp commented Jul 8, 2025

Copy link
Copy Markdown
Collaborator

We lose a lot of context (including the file path) w/ this approach but I'm not sure I've got a better alternative

@flihp

flihp commented Jul 9, 2025

Copy link
Copy Markdown
Collaborator Author

this seems relevant: oxidecomputer/omicron#8558

Comment thread tls/src/lib.rs
@@ -50,10 +48,6 @@ pub enum Error {
#[error("io error: {0}")]
Io(#[from] std::io::Error),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As you surmised, John's doc is helpful here. There is no need to lose this context, it just gets a tad more tedious in usage. We should add specific errors for opening and reading files as described in https://github.com/oxidecomputer/omicron/blob/john/error-docs/docs/error-types-and-logging.adoc#2-defining-error-enums-with-thiserror.

We'd then change the #[from] to #[source] for the underlying error and add a path field that we could report in the Display impl with the same messages as we did previously in with_context.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

https://github.com/oxidecomputer/omicron/blob/main/docs/error-types-and-logging.adoc this is now merged if like me you went to click on the link and it now 404's

@flihp
flihp force-pushed the no-anyhow-in-lib branch from 4d19061 to 6b87cc4 Compare July 22, 2025 21:48
@flihp

flihp commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator Author

Lost track of this one. I've updated it w/ recommendations from john's doc. Apologies for the delay. Now all I've gotta do is go back and fix all the rust I've ever written :)

@andrewjstone andrewjstone left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Excellent.

@flihp
flihp merged commit 43dc6c5 into oxidecomputer:main Jul 23, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants