Skip to content

Commit

Permalink
fix(Read/Write Files from Disk Node): Better error handling when file…
Browse files Browse the repository at this point in the history
… name missing (no-changelog) (n8n-io#10463)
  • Loading branch information
ShireenMissi authored Aug 19, 2024
1 parent 17ac784 commit 6a0f2ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -124,7 +130,6 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
},
});
}

returnData.push(...newItems);
} catch (error) {
const nodeOperatioinError = errorMapper.call(this, error, itemIndex, {
Expand All @@ -142,7 +147,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
});
continue;
}
throw nodeOperatioinError;
throw new NodeApiError(this.getNode(), error as JsonObject, { itemIndex });
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -114,7 +119,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
});
continue;
}
throw nodeOperatioinError;
throw new NodeApiError(this.getNode(), error as JsonObject, { itemIndex });
}
}

Expand Down

0 comments on commit 6a0f2ca

Please sign in to comment.