Skip to content

Commit

Permalink
Better error message if cargo metadata fails
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty committed Oct 12, 2024
1 parent a982c4c commit 84f0cc0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cargo-insta/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,12 @@ fn handle_target_args<'a>(
(None, None) => {}
};

let metadata = cmd.exec()?;
let metadata = cmd.exec().map_err(|e| {
format!(
"failed to load cargo metadata: {}. Command details: {:?}",
e, cmd
)
})?;
let workspace_root = metadata.workspace_root.as_std_path().to_path_buf();
let tool_config = ToolConfig::from_workspace(&workspace_root)?;

Expand Down

0 comments on commit 84f0cc0

Please sign in to comment.