From 5ad50e65d4b1d84d874adbbc7af7e5934f65db0a Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 29 Dec 2025 00:40:13 -0600 Subject: [PATCH] Enhance syncback error handling by including full instance paths in duplicate name error messages. Updated the syncback_project function to provide clearer context when instances with duplicate names are detected. --- src/snapshot_middleware/project.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/snapshot_middleware/project.rs b/src/snapshot_middleware/project.rs index 8e9735e5..90d743a7 100644 --- a/src/snapshot_middleware/project.rs +++ b/src/snapshot_middleware/project.rs @@ -20,7 +20,7 @@ use crate::{ PathIgnoreRule, SyncRule, }, snapshot_middleware::Middleware, - syncback::{filter_properties, FsSnapshot, SyncbackReturn, SyncbackSnapshot}, + syncback::{filter_properties, inst_path, FsSnapshot, SyncbackReturn, SyncbackSnapshot}, variant_eq::variant_eq, RojoRef, }; @@ -413,9 +413,11 @@ pub fn syncback_project<'sync>( .get_new_instance(*child_ref) .expect("all children of Instances should be in new DOM"); if new_child_map.insert(&child.name, child).is_some() { + let parent_path = inst_path(snapshot.new_tree(), new_inst.referent()); anyhow::bail!( "Instances that are direct children of an Instance that is made by a project file \ - must have a unique name.\nThe child '{}' of '{}' is duplicated in the place file.", child.name, old_inst.name() + must have a unique name.\nThe child '{}' is duplicated in the place file.\n\ + Full path: {}/{}", child.name, parent_path, child.name ); } } @@ -424,9 +426,11 @@ pub fn syncback_project<'sync>( .get_old_instance(*child_ref) .expect("all children of Instances should be in old DOM"); if old_child_map.insert(child.name(), child).is_some() { + let parent_path = inst_path(snapshot.old_tree(), old_inst.id()); anyhow::bail!( "Instances that are direct children of an Instance that is made by a project file \ - must have a unique name.\nThe child '{}' of '{}' is duplicated on the file system.", child.name(), old_inst.name() + must have a unique name.\nThe child '{}' is duplicated on the file system.\n\ + Full path: {}/{}", child.name(), parent_path, child.name() ); } }