chore(core): Stop reporting TypeError and AttributeError from Python sandbox to Sentry (#12078)

This commit is contained in:
Iván Ovejero 2024-12-09 09:17:26 +01:00 committed by GitHub
parent 891dd7f995
commit aece4c497a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;