Skip to content

Commit 502a645

Browse files
authoredSep 18, 2023
feat(error): Error::source() is purposefully unspecified (#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 #2843 BREAKING CHANGE: Do not build any logic depending on the exact types of an `Error::source()`. They are only for debugging.
1 parent 3995c63 commit 502a645

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/error.rs

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ type Cause = Box<dyn StdError + Send + Sync>;
2020
/// The contents of the formatted error message of this specific `Error` type
2121
/// is unspecified. **You must not depend on it.** The wording and details may
2222
/// change in any version, with the goal of improving error messages.
23+
///
24+
/// # Source
25+
///
26+
/// A `hyper::Error` may be caused by another error. To aid in debugging,
27+
/// those are exposed in `Error::source()` as erased types. While it is
28+
/// possible to check the exact type of the sources, they **can not be depended
29+
/// on**. They may come from private internal dependencies, and are subject to
30+
/// change at any moment.
2331
pub struct Error {
2432
inner: Box<ErrorImpl>,
2533
}

0 commit comments

Comments
 (0)
Please sign in to comment.