Skip to content

Commit 8bb3775

Browse files
committed
store: Produce more informative error in Layout.find_many
1 parent b62e75c commit 8bb3775

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

store/postgres/src/relational.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,15 @@ impl Layout {
559559
entity_id: entity_data.id(),
560560
causality_region: CausalityRegion::from_entity(&entity_data),
561561
};
562-
let overwrite = entities.insert(key, entity_data).is_some();
563-
if overwrite {
564-
return Err(constraint_violation!("duplicate entity in result set"));
562+
if entities.contains_key(&key) {
563+
return Err(constraint_violation!(
564+
"duplicate entity {}[{}] in result set, block = {}",
565+
key.entity_type,
566+
key.entity_id,
567+
block
568+
));
569+
} else {
570+
entities.insert(key, entity_data);
565571
}
566572
}
567573
Ok(entities)

0 commit comments

Comments
 (0)