mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +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:
@@ -7,7 +7,7 @@ import type {
|
||||
INodePropertyOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
import { ApplicationError, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
@@ -136,7 +136,7 @@ export async function getForms(this: ILoadOptionsFunctions): Promise<INodeProper
|
||||
});
|
||||
|
||||
if (responseData.items === undefined) {
|
||||
throw new Error('No data got returned');
|
||||
throw new ApplicationError('No data got returned', { level: 'warning' });
|
||||
}
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
for (const baseData of responseData.items) {
|
||||
@@ -160,7 +160,7 @@ export async function getFields(
|
||||
const responseData = await apiRequestAllItems.call(this, 'GET', endpoint, {}, 'fields');
|
||||
|
||||
if (responseData.items === undefined) {
|
||||
throw new Error('No form fields meta data got returned');
|
||||
throw new ApplicationError('No form fields meta data got returned', { level: 'warning' });
|
||||
}
|
||||
|
||||
const fields = responseData.items as IFormstackFieldDefinitionType[];
|
||||
@@ -185,7 +185,7 @@ export async function getSubmission(
|
||||
const responseData = await apiRequestAllItems.call(this, 'GET', endpoint, {}, 'data');
|
||||
|
||||
if (responseData.items === undefined) {
|
||||
throw new Error('No form fields meta data got returned');
|
||||
throw new ApplicationError('No form fields meta data got returned', { level: 'warning' });
|
||||
}
|
||||
|
||||
return responseData.items as IFormstackSubmissionFieldContainer[];
|
||||
|
||||
Reference in New Issue
Block a user