feat: adds validation check for connectors with less than 2 anchors

This commit is contained in:
Mark Mankarious
2023-10-04 18:23:43 +01:00
parent 4da997f3f3
commit 880ed5bea7

View File

@@ -58,6 +58,12 @@ export const ensureValidConnector = (
allAnchors: ConnectorAnchor[],
nodes: NodeInput[]
) => {
if (connector.anchors.length < 2) {
throw new Error(
`Found invalid connector [id: "${connector.id}"]: A connector must have at least 2 anchors.`
);
}
connector.anchors.forEach((anchor) => {
try {
ensureValidConnectorAnchor(anchor, allAnchors, nodes);