diff --git a/AGENTS.md b/AGENTS.md index fc164c081..b5a62a2b3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -31,6 +31,11 @@ reviewable, and compatible with the project's normal engineering constraints. migration implications. - Do not invent APIs, behavior, or requirements. If something is uncertain, state the uncertainty and proceed only with minimal, explicit assumptions. +- For `thiserror`-style errors, start messages with a capital letter and keep + the outer `Display` text short. Put all non-`#[source]` attributes in the + message to improve helpfulness, but do not repeat a `#[source]` value + inline: Cloud Hypervisor prints the full error chain, so only include the + concrete failure text directly when there is no source to report. ### Safety and Domain Notes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88a3627bc..5d3b70b0e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,6 +44,12 @@ state changes that matter in production; use `warn!` or `error!` only for abnormal conditions. Keep `debug!` for focused diagnostics. Please find more information in [`docs/logging.md`](docs/logging.md). +Error messages should be sentence-style: start with a capital letter and stay +concise. For `thiserror`-style errors, put all non-`#[source]` attributes +(if they provide clear value) in the outer `Display` text to improve helpfulness, +but do not repeat a `#[source]` value there because Cloud Hypervisor prints the +full chain elsewhere. + [Rust Style]: https://github.com/rust-lang/rust/tree/HEAD/src/doc/style-guide/src ## Basic Checks