From caaca140cadf1a4a610d5f95ba2b70712a872e39 Mon Sep 17 00:00:00 2001 From: Andrew Walbran Date: Mon, 16 Jan 2023 17:51:03 +0000 Subject: [PATCH] Another note for anyhow. --- src/error-handling/error-contexts.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/error-handling/error-contexts.md b/src/error-handling/error-contexts.md index ae006e9b..bb676d39 100644 --- a/src/error-handling/error-contexts.md +++ b/src/error-handling/error-contexts.md @@ -33,9 +33,10 @@ fn main() {
* `anyhow::Result` is a type alias for `Result`. -* `anyhow::Error` is generic and it can hold any `Error` implementation without changing the type signature. +* `anyhow::Error` is essentially a wrapper around `Box`. As such it's again generally not + a good choice for the public API of a library, but is widely used in applications. * Actual error type inside of it can be extracted for examination if necessary. -* Functionality provided by `anyhow::Result` may be familiar to Go developers, as it provides similar usage patterns and ergonomics - of `(T, error)` from Go. +* Functionality provided by `anyhow::Result` may be familiar to Go developers, as it provides + similar usage patterns and ergonomics to `(T, error)` from Go.