Skip to content

Commit

Permalink
feat(error): Error::source() is purposefully unspecified
Browse files Browse the repository at this point in the history
Document that the exact types returned in the erased errors of
`Error::source()` may change at any moment, and cannot be depended on.

Closes #2843

BREAKING CHANGE: Do not build any logic depending on the exact types of
  an `Error::source()`. They are only for debugging.
  • Loading branch information
seanmonstar committed Sep 18, 2023
1 parent 50f123a commit d4adcc3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ type Cause = Box<dyn StdError + Send + Sync>;
/// The contents of the formatted error message of this specific `Error` type
/// is unspecified. **You must not depend on it.** The wording and details may
/// change in any version, with the goal of improving error messages.
///
/// # Source
///
/// A `hyper::Error` may be caused by another error. To aid in debugging,
/// those are exposed in `Error::source()` as erased types. While it is
/// possible to check the exact type of the sources, they **can not be depended
/// on**. They may come from private internal dependencies, and are subject to
/// change at any moment.
pub struct Error {
inner: Box<ErrorImpl>,
}
Expand Down

0 comments on commit d4adcc3

Please sign in to comment.