fix(core): Throw error if required sub-node connection is missing (no-changelog) (#10123)

This commit is contained in:
oleg 2024-07-19 19:25:45 +02:00 committed by GitHub
parent a8b5551331
commit 936cb57d79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2755,6 +2755,12 @@ async function getInputConnectionData(
const parentNodes = workflow.getParentNodes(node.name, inputName, 1); const parentNodes = workflow.getParentNodes(node.name, inputName, 1);
if (parentNodes.length === 0) { 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 : []; return inputConfiguration.maxConnections === 1 ? undefined : [];
} }
@ -2888,7 +2894,10 @@ async function getInputConnectionData(
const nodes = await Promise.all(constParentNodes); const nodes = await Promise.all(constParentNodes);
if (inputConfiguration.required && nodes.length === 0) { 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 ( if (
inputConfiguration.maxConnections !== undefined && inputConfiguration.maxConnections !== undefined &&
@ -2896,7 +2905,7 @@ async function getInputConnectionData(
) { ) {
throw new NodeOperationError( throw new NodeOperationError(
node, 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`,
); );
} }