mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
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.
This commit is contained in:
parent
777b060428
commit
5ad50e65d4
1 changed files with 7 additions and 3 deletions
|
|
@ -20,7 +20,7 @@ use crate::{
|
||||||
PathIgnoreRule, SyncRule,
|
PathIgnoreRule, SyncRule,
|
||||||
},
|
},
|
||||||
snapshot_middleware::Middleware,
|
snapshot_middleware::Middleware,
|
||||||
syncback::{filter_properties, FsSnapshot, SyncbackReturn, SyncbackSnapshot},
|
syncback::{filter_properties, inst_path, FsSnapshot, SyncbackReturn, SyncbackSnapshot},
|
||||||
variant_eq::variant_eq,
|
variant_eq::variant_eq,
|
||||||
RojoRef,
|
RojoRef,
|
||||||
};
|
};
|
||||||
|
|
@ -413,9 +413,11 @@ pub fn syncback_project<'sync>(
|
||||||
.get_new_instance(*child_ref)
|
.get_new_instance(*child_ref)
|
||||||
.expect("all children of Instances should be in new DOM");
|
.expect("all children of Instances should be in new DOM");
|
||||||
if new_child_map.insert(&child.name, child).is_some() {
|
if new_child_map.insert(&child.name, child).is_some() {
|
||||||
|
let parent_path = inst_path(snapshot.new_tree(), new_inst.referent());
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
"Instances that are direct children of an Instance that is made by a project file \
|
"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)
|
.get_old_instance(*child_ref)
|
||||||
.expect("all children of Instances should be in old DOM");
|
.expect("all children of Instances should be in old DOM");
|
||||||
if old_child_map.insert(child.name(), child).is_some() {
|
if old_child_map.insert(child.name(), child).is_some() {
|
||||||
|
let parent_path = inst_path(snapshot.old_tree(), old_inst.id());
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
"Instances that are direct children of an Instance that is made by a project file \
|
"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()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue