From aece4c497a61a10ef0b76a9cbe74222771ecbc48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 9 Dec 2024 09:17:26 +0100 Subject: [PATCH] chore(core): Stop reporting `TypeError` and `AttributeError` from Python sandbox to Sentry (#12078) --- packages/nodes-base/nodes/Code/PythonSandbox.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/nodes-base/nodes/Code/PythonSandbox.ts b/packages/nodes-base/nodes/Code/PythonSandbox.ts index 13a3bb6228..365f213500 100644 --- a/packages/nodes-base/nodes/Code/PythonSandbox.ts +++ b/packages/nodes-base/nodes/Code/PythonSandbox.ts @@ -1,4 +1,4 @@ -import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow'; +import { ApplicationError, type IExecuteFunctions, type INodeExecutionData } from 'n8n-workflow'; import type { PyDict } from 'pyodide/ffi'; import { LoadPyodide } from './Pyodide'; import type { SandboxContext } from './Sandbox'; @@ -97,7 +97,9 @@ await __main()`; private getPrettyError(error: PyodideError): Error { const errorTypeIndex = error.message.indexOf(error.type); if (errorTypeIndex !== -1) { - return new Error(error.message.slice(errorTypeIndex)); + return new ApplicationError(error.message.slice(errorTypeIndex), { + level: ['TypeError', 'AttributeError'].includes(error.type) ? 'warning' : 'error', + }); } return error;