Improve continueOnFail behaviour

This commit is contained in:
Jan Oberhauser
2020-03-17 13:18:04 +01:00
parent 3bf0a9ab10
commit ce0aaeba7d
4 changed files with 46 additions and 5 deletions

View File

@@ -457,12 +457,12 @@ export class NextCloud implements INodeType {
let endpoint = '';
let requestMethod = '';
let responseData: any; // tslint:disable-line:no-any
let body: string | Buffer = '';
const headers: IDataObject = {};
for (let i = 0; i < items.length; i++) {
if (resource === 'file') {
if (operation === 'download') {
// ----------------------------------
@@ -580,7 +580,16 @@ export class NextCloud implements INodeType {
options.encoding = null;
}
const responseData = await this.helpers.request(options);
try {
responseData = await this.helpers.request(options);
} catch (error) {
if (this.continueOnFail() === true) {
returnData.push({ error });
continue;
}
throw error;
}
if (resource === 'file' && operation === 'download') {
@@ -656,6 +665,7 @@ export class NextCloud implements INodeType {
} else {
returnData.push(responseData as IDataObject);
}
}
if (resource === 'file' && operation === 'download') {