diff --git a/crates/puffin-client/src/client.rs b/crates/puffin-client/src/client.rs index a239397e1..1d71174d7 100644 --- a/crates/puffin-client/src/client.rs +++ b/crates/puffin-client/src/client.rs @@ -171,7 +171,7 @@ impl RegistryClient { match self.simple_impl(&url).await { Ok(text) => { return serde_json::from_str(&text) - .map_err(move |e| Error::from_json_err(e, String::new())); + .map_err(move |e| Error::from_json_err(e, url)); } Err(err) => { if err.status() == Some(StatusCode::NOT_FOUND) { diff --git a/crates/puffin-client/src/error.rs b/crates/puffin-client/src/error.rs index 614a904ca..0c32f1a01 100644 --- a/crates/puffin-client/src/error.rs +++ b/crates/puffin-client/src/error.rs @@ -41,11 +41,8 @@ pub enum Error { #[error(transparent)] RequestMiddlewareError(#[from] reqwest_middleware::Error), - #[error("Received some unexpected JSON: {source}")] - BadJson { - source: serde_json::Error, - url: String, - }, + #[error("Received some unexpected JSON from {url}")] + BadJson { source: serde_json::Error, url: Url }, #[error(transparent)] AsyncHttpRangeReader(#[from] AsyncHttpRangeReaderError), @@ -71,7 +68,7 @@ pub enum Error { } impl Error { - pub fn from_json_err(err: serde_json::Error, url: String) -> Self { + pub fn from_json_err(err: serde_json::Error, url: Url) -> Self { Self::BadJson { source: err, url } } }