Improve error message when i-slint-core-macro's attempt to read link-data.json fails

Provide the (absolute) path to the file in the panic message.
This commit is contained in:
Simon Hausmann 2024-12-31 15:34:06 +01:00
parent 7d20db9be0
commit cf910d3f23

View file

@ -25,7 +25,7 @@ impl syn::visit_mut::VisitMut for Visitor {
impl Visitor {
pub fn new() -> Self {
let link_path = concat!(env!("CARGO_MANIFEST_DIR"), "/link-data.json");
let link_data = std::fs::read_to_string(link_path).expect("Failed to read link-data.json");
let link_data = std::fs::read_to_string(link_path).expect("Failed to read {link_path}");
let link_data: serde_json::Value =
serde_json::from_str(&link_data).expect("Failed to parse link-data.json");
Self(link_data, false)