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

@@ -1,5 +1,5 @@
import type { IRun, WorkflowTestData } from 'n8n-workflow';
import { createDeferredPromise, Workflow } from 'n8n-workflow';
import { ApplicationError, createDeferredPromise, Workflow } from 'n8n-workflow';
import { WorkflowExecute } from '@/WorkflowExecute';
import * as Helpers from './helpers';
@@ -45,7 +45,7 @@ describe('WorkflowExecute', () => {
// Check if the output data of the nodes is correct
for (const nodeName of Object.keys(testData.output.nodeData)) {
if (result.data.resultData.runData[nodeName] === undefined) {
throw new Error(`Data for node "${nodeName}" is missing!`);
throw new ApplicationError('Data for node is missing', { extra: { nodeName } });
}
const resultData = result.data.resultData.runData[nodeName].map((nodeData) => {
@@ -108,7 +108,7 @@ describe('WorkflowExecute', () => {
// Check if the output data of the nodes is correct
for (const nodeName of Object.keys(testData.output.nodeData)) {
if (result.data.resultData.runData[nodeName] === undefined) {
throw new Error(`Data for node "${nodeName}" is missing!`);
throw new ApplicationError('Data for node is missing', { extra: { nodeName } });
}
const resultData = result.data.resultData.runData[nodeName].map((nodeData) => {
@@ -172,7 +172,7 @@ describe('WorkflowExecute', () => {
// Check if the output data of the nodes is correct
for (const nodeName of Object.keys(testData.output.nodeData)) {
if (result.data.resultData.runData[nodeName] === undefined) {
throw new Error(`Data for node "${nodeName}" is missing!`);
throw new ApplicationError('Data for node is missing', { extra: { nodeName } });
}
const resultData = result.data.resultData.runData[nodeName].map((nodeData) => {