From 8b5701658806f09f969460b7001715b2136179dd Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 18 Sep 2023 10:35:44 -0400 Subject: [PATCH] feat(error): `Error::source()` is purposefully unspecified 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. --- src/error.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/error.rs b/src/error.rs index eda4f5158e..416efcc99a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -20,6 +20,14 @@ type Cause = Box; /// 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, }