Skip to content

Commit

Permalink
fix(core): Throw error if required sub-node connection is missing (no…
Browse files Browse the repository at this point in the history
…-changelog) (#10123)
  • Loading branch information
OlegIvaniv authored Jul 19, 2024
1 parent a8b5551 commit 936cb57
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2755,6 +2755,12 @@ async function getInputConnectionData(

const parentNodes = workflow.getParentNodes(node.name, inputName, 1);
if (parentNodes.length === 0) {
if (inputConfiguration.required) {
throw new NodeOperationError(
node,
`A ${inputConfiguration?.displayName ?? inputName} sub-node must be connected`,
);
}
return inputConfiguration.maxConnections === 1 ? undefined : [];
}

Expand Down Expand Up @@ -2888,15 +2894,18 @@ async function getInputConnectionData(
const nodes = await Promise.all(constParentNodes);

if (inputConfiguration.required && nodes.length === 0) {
throw new NodeOperationError(node, `A ${inputName} processor node must be connected`);
throw new NodeOperationError(
node,
`A ${inputConfiguration?.displayName ?? inputName} sub-node must be connected`,
);
}
if (
inputConfiguration.maxConnections !== undefined &&
nodes.length > inputConfiguration.maxConnections
) {
throw new NodeOperationError(
node,
`Only ${inputConfiguration.maxConnections} ${inputName} processor nodes are/is allowed to be connected`,
`Only ${inputConfiguration.maxConnections} ${inputName} sub-nodes are/is allowed to be connected`,
);
}

Expand Down

0 comments on commit 936cb57

Please sign in to comment.