Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'docs/dev/style.md')
-rw-r--r--docs/dev/style.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md
index d2a03fba40..786127639c 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -869,6 +869,19 @@ type -> ty
**Rationale:** consistency.
+## Error Handling Trivia
+
+Use `anyhow::Result` rather than just `Result`.
+
+**Rationale:** makes it immediately clear what result that is.
+
+Use `anyhow::format_err!` rather than `anyhow::anyhow`.
+
+**Rationale:** consistent, boring, avoids stuttering.
+
+There's no specific guidance on the formatting of error messages, see [anyhow/#209](https://github.com/dtolnay/anyhow/issues/209).
+Do not end error and context messages with `.` though.
+
## Early Returns
Do use early returns