diff --git a/src/client/http/connection.rs b/src/client/http/connection.rs index c7cd2c14..0558a7e1 100644 --- a/src/client/http/connection.rs +++ b/src/client/http/connection.rs @@ -81,10 +81,13 @@ impl HttpError { where E: Error + Send + Sync + 'static, { - Self { - kind, - source: Box::new(e), - } + Self::new_boxed(kind, Box::new(e)) + } + + #[inline] + /// Create a new [`HttpError`] with provided `source` error + pub fn new_boxed(kind: HttpErrorKind, source: Box) -> Self { + Self { kind, source } } #[cfg(feature = "reqwest")]