refactor(core): Switch plain errors in core to ApplicationError (no-changelog) (#7873)

Ensure all errors in `core` are `ApplicationError` or children of it and
contain no variables in the message, to continue normalizing all the
errors we report to Sentry

Follow-up to: https://github.com/n8n-io/n8n/pull/7857
This commit is contained in:
Iván Ovejero
2023-11-30 09:06:19 +01:00
committed by GitHub
parent cd474f1562
commit b16dd21909
10 changed files with 135 additions and 101 deletions

View File

@@ -38,6 +38,7 @@ import {
WorkflowOperationError,
NodeHelpers,
NodeConnectionType,
ApplicationError,
} from 'n8n-workflow';
import get from 'lodash/get';
import * as NodeExecuteFunctions from './NodeExecuteFunctions';
@@ -89,7 +90,7 @@ export class WorkflowExecute {
startNode = startNode || workflow.getStartNode(destinationNode);
if (startNode === undefined) {
throw new Error('No node to start the workflow from could be found!');
throw new ApplicationError('No node to start the workflow from could be found');
}
// If a destination node is given we only run the direct parent nodes and no others
@@ -929,7 +930,9 @@ export class WorkflowExecute {
currentExecutionTry = `${executionNode.name}:${runIndex}`;
if (currentExecutionTry === lastExecutionTry) {
throw new Error('Did stop execution because execution seems to be in endless loop.');
throw new ApplicationError(
'Stopped execution because it seems to be in an endless loop',
);
}
if (
@@ -1412,9 +1415,12 @@ export class WorkflowExecute {
outputIndex
]) {
if (!workflow.nodes.hasOwnProperty(connectionData.node)) {
throw new Error(
`The node "${executionNode.name}" connects to not found node "${connectionData.node}"`,
);
throw new ApplicationError('Destination node not found', {
extra: {
sourceNodeName: executionNode.name,
destinationNodeName: connectionData.node,
},
});
}
if (