Skip to content

Commit 3d78fcb

Browse files
authored
fix: Display for Error shouldn't include source (#2199)
1 parent c535724 commit 3d78fcb

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/error.rs

-4
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,6 @@ impl fmt::Display for Error {
206206
write!(f, " for url ({url})")?;
207207
}
208208

209-
if let Some(e) = &self.inner.source {
210-
write!(f, ": {e}")?;
211-
}
212-
213209
Ok(())
214210
}
215211
}

src/into_url.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,23 @@ if_hyper! {
8484
#[cfg(test)]
8585
mod tests {
8686
use super::*;
87+
use std::error::Error;
8788

8889
#[test]
8990
fn into_url_file_scheme() {
9091
let err = "file:///etc/hosts".into_url().unwrap_err();
9192
assert_eq!(
92-
err.to_string(),
93-
"builder error for url (file:///etc/hosts): URL scheme is not allowed"
93+
err.source().unwrap().to_string(),
94+
"URL scheme is not allowed"
9495
);
9596
}
9697

9798
#[test]
9899
fn into_url_blob_scheme() {
99100
let err = "blob:https://example.com".into_url().unwrap_err();
100101
assert_eq!(
101-
err.to_string(),
102-
"builder error for url (blob:https://example.com): URL scheme is not allowed"
102+
err.source().unwrap().to_string(),
103+
"URL scheme is not allowed"
103104
);
104105
}
105106

0 commit comments

Comments
 (0)