Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion library/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ use crate::fmt::{self, Debug, Display, Formatter};
/// assert_eq!(err.to_string(), "invalid digit found in string");
/// ```
///
/// # Error source
///
/// Errors may provide cause information. [`Error::source()`] is generally
/// used when errors cross "abstraction boundaries". If one module must report
/// an error that is caused by an error from a lower-level module, it can allow
/// accessing that error via [`Error::source()`]. This makes it possible for the
/// accessing that error via `Error::source()`. This makes it possible for the
/// high-level module to provide its own errors while also revealing some of the
/// implementation for debugging.
///
/// In error types that wrap an underlying error, the underlying error
/// should be either returned by the outer error's `Error::source()`, or rendered
/// by the outer error's `Display` implementation, but not both.
///
/// # Example
///
/// Implementing the `Error` trait only requires that `Debug` and `Display` are implemented too.
Expand Down
Loading