mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor: Switch plain errors in nodes-base to ApplicationError (no-changelog) (#7914)
Ensure all errors in `nodes-base` are `ApplicationError` or children of it and contain no variables in the message, to continue normalizing all the backend errors we report to Sentry. Also, skip reporting to Sentry errors from user input and from external APIs. In future we should refine `ApplicationError` to more specific errors. Follow-up to: [#7877](https://github.com/n8n-io/n8n/pull/7877) - [x] Test workflows: https://github.com/n8n-io/n8n/actions/runs/7084627970 - [x] e2e: https://github.com/n8n-io/n8n/actions/runs/7084936861 --------- Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { anyNumber, mock } from 'jest-mock-extended';
|
||||
import { NodeVM } from '@n8n/vm2';
|
||||
import type { IExecuteFunctions, IWorkflowDataProxyData } from 'n8n-workflow';
|
||||
import { NodeHelpers } from 'n8n-workflow';
|
||||
import { ApplicationError, NodeHelpers } from 'n8n-workflow';
|
||||
import { normalizeItems } from 'n8n-core';
|
||||
import { Code } from '../Code.node';
|
||||
import { ValidationError } from '../ValidationError';
|
||||
@@ -79,7 +79,7 @@ describe('Code Node unit test', () => {
|
||||
|
||||
try {
|
||||
await node.execute.call(thisArg);
|
||||
throw new Error("Validation error wasn't thrown");
|
||||
throw new ApplicationError("Validation error wasn't thrown", { level: 'warning' });
|
||||
} catch (error) {
|
||||
expect(error).toBeInstanceOf(ValidationError);
|
||||
expect(error.message).toEqual("A 'json' property isn't an object [item 0]");
|
||||
@@ -131,7 +131,7 @@ describe('Code Node unit test', () => {
|
||||
|
||||
try {
|
||||
await node.execute.call(thisArg);
|
||||
throw new Error("Validation error wasn't thrown");
|
||||
throw new ApplicationError("Validation error wasn't thrown", { level: 'warning' });
|
||||
} catch (error) {
|
||||
expect(error).toBeInstanceOf(ValidationError);
|
||||
expect(error.message).toEqual("A 'json' property isn't an object [item 0]");
|
||||
|
||||
Reference in New Issue
Block a user