Skip to content

Commit

Permalink
feat(error): Error::source() is purposefully unspecified (hyperium#…
Browse files Browse the repository at this point in the history
…3318)

Document that the exact types returned in the erased errors of
`Error::source()` may change at any moment, and cannot be depended on.

Closes hyperium#2843

BREAKING CHANGE: Do not build any logic depending on the exact types of
  an `Error::source()`. They are only for debugging.

Signed-off-by: Sven Pfennig <[email protected]>
  • Loading branch information
seanmonstar authored and 0xE282B0 committed Jan 16, 2024
1 parent 4ba2d85 commit d354fe4
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 d354fe4

Please sign in to comment.