Skip to content

Commit

Permalink
Include path to metadata error
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 13, 2024
1 parent 9996877 commit 146be0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Package {
pub id: PackageId,
pub targets: Vec<Target>,
#[serde(deserialize_with = "deserialize_docs_rs")]
pub metadata: Result<DocumentationOptions, serde_json::Error>,
pub metadata: Result<DocumentationOptions, serde_path_to_error::Error<serde_json::Error>>,
}

#[derive(Deserialize, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
Expand Down Expand Up @@ -61,7 +61,7 @@ pub struct DocumentationOptions {

fn deserialize_docs_rs<'de, D>(
deserializer: D,
) -> Result<serde_json::Result<DocumentationOptions>, D::Error>
) -> Result<Result<DocumentationOptions, serde_path_to_error::Error<serde_json::Error>>, D::Error>
where
D: Deserializer<'de>,
{
Expand All @@ -81,7 +81,7 @@ where
return Ok(default);
};

Ok(serde_json::from_value(value))
Ok(serde_path_to_error::deserialize(value))
}

impl Package {
Expand Down

0 comments on commit 146be0d

Please sign in to comment.