feat(editor): Improve errors in output panel (#8644)

Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
Giulio Andreini
2024-03-07 17:08:01 +01:00
committed by GitHub
parent 6e2aa405fc
commit 5301323906
38 changed files with 772 additions and 287 deletions

View File

@@ -1,5 +1,6 @@
import { ApplicationError, type IDataObject, type NodeApiError } from 'n8n-workflow';
import type { UpdateRecord } from './interfaces';
import set from 'lodash/set';
export function removeIgnored(data: IDataObject, ignore: string | string[]) {
if (ignore) {
@@ -66,13 +67,18 @@ export function findMatches(
}
}
export function processAirtableError(error: NodeApiError, id?: string) {
export function processAirtableError(error: NodeApiError, id?: string, itemIndex?: number) {
if (error.description === 'NOT_FOUND' && id) {
error.description = `${id} is not a valid Record ID`;
}
if (error.description?.includes('You must provide an array of up to 10 record objects') && id) {
error.description = `${id} is not a valid Record ID`;
}
if (itemIndex !== undefined) {
set(error, 'context.itemIndex', itemIndex);
}
return error;
}