fix(Read/Write Files from Disk Node): Better error handling when file name missing (no-changelog) (#10463)

This commit is contained in:
Shireen Missi 2024-08-19 13:07:39 +01:00 committed by GitHub
parent 17ac7844f2
commit 6a0f2ca96b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 6 deletions

View file

@ -1,4 +1,10 @@
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
import type {
IExecuteFunctions,
INodeExecutionData,
INodeProperties,
JsonObject,
} from 'n8n-workflow';
import glob from 'fast-glob';
import { errorMapper } from '../helpers/utils';
@ -124,7 +130,6 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
},
});
}
returnData.push(...newItems);
} catch (error) {
const nodeOperatioinError = errorMapper.call(this, error, itemIndex, {
@ -142,7 +147,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
});
continue;
}
throw nodeOperatioinError;
throw new NodeApiError(this.getNode(), error as JsonObject, { itemIndex });
}
}

View file

@ -1,6 +1,11 @@
import type { Readable } from 'stream';
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { BINARY_ENCODING } from 'n8n-workflow';
import type {
IExecuteFunctions,
INodeExecutionData,
INodeProperties,
JsonObject,
} from 'n8n-workflow';
import { BINARY_ENCODING, NodeApiError } from 'n8n-workflow';
import { errorMapper } from '../helpers/utils';
import { updateDisplayOptions } from '@utils/utilities';
@ -114,7 +119,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
});
continue;
}
throw nodeOperatioinError;
throw new NodeApiError(this.getNode(), error as JsonObject, { itemIndex });
}
}