Skip to content

Actually print out some errors#100

Merged
labbott merged 2 commits into
mainfrom
seriously_better_errors
Feb 5, 2026
Merged

Actually print out some errors#100
labbott merged 2 commits into
mainfrom
seriously_better_errors

Conversation

@labbott

@labbott labbott commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@labbott labbott requested a review from andrewjstone February 3, 2026 19:11
Comment thread tls/src/lib.rs Outdated
},

#[error("RotRequest")]
#[error("RotRequest {0}")]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

would have really liked this earlier

18:53:45.720Z ERRO SledAgent (trust-quorum): failed to load certified key: RotRequest
    baseboard_id = 913-0000023:BRM13250012
    file = /home/build/.cargo/git/checkouts/sprockets-882d17aeeb0cb343/8ba93f6/tls/src/server.rs:80

@jgallagher jgallagher Feb 3, 2026

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.

This is very annoying, but: these changes are not correct. We need to update the logging sites, not the error types. More on this whole unfortunate error type design: https://github.com/oxidecomputer/omicron/blob/main/docs/error-types-and-logging.adoc. (The changes in this branch are "Pitfall 2" of that doc.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

bleh I read that and thought I understood what I needed to do. Clearly not!

@labbott labbott force-pushed the seriously_better_errors branch from 2943f68 to ad905a2 Compare February 4, 2026 13:55
Comment thread tls/src/client.rs Outdated
}
Err(e) => {
error!(self.log, "failed to load certified key: {e}");
error!(self.log, "failed to load certified key: {e:#}");

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.

Sorry again for the state of this :(. {e:#} only works for anyhow::Error and does nothing for other error types, so this still won't do what you want.

It looks like this is this crate's Error type, which already derives SlogInlineError, so I believe this can be

Suggested change
error!(self.log, "failed to load certified key: {e:#}");
error!(self.log, "failed to load certified key"; e);

since deriving SlogInlineError makes the type implement slog::KV (in a way that will print the entire chain).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I forgot we weren't using anyhow here 🙃

@labbott labbott merged commit d2b68e4 into main Feb 5, 2026
8 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.

2 participants