Skip to content

Commit 82d52f9

Browse files
committed
make error more generic
1 parent 0598eb8 commit 82d52f9

File tree

1 file changed

+1
-2
lines changed
  • src/power_grid_model_ds/_core/model/graphs/models

1 file changed

+1
-2
lines changed

src/power_grid_model_ds/_core/model/graphs/models/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def delete_node(self, ext_node_id: int, raise_on_fail: bool = True) -> None:
9494
def add_node_array(self, node_array: NodeArray, raise_on_fail: bool = True) -> None:
9595
"""Add all nodes in the node array to the graph."""
9696
if raise_on_fail and any(self.has_node(x) for x in node_array["id"]):
97-
existing_ids = [x for x in node_array["id"] if self.has_node(x)]
98-
raise GraphError(f"{len(existing_ids)} external node ids already exist!")
97+
raise GraphError("At least one node id already exists in the Graph.")
9998
self._add_nodes(node_array["id"].tolist())
10099

101100
def delete_node_array(self, node_array: NodeArray, raise_on_fail: bool = True) -> None:

0 commit comments

Comments
 (0)