Add continueOnFail to Google Calendar (#1722)

*  Add continueOnFail to Google Calendar

*  Minor improvements

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Ricardo Espinoza 2021-05-01 23:50:15 -04:00 committed by GitHub
parent c972f3dd50
commit 469b92e32a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,6 +180,7 @@ export class GoogleCalendar implements INodeType {
const resource = this.getNodeParameter('resource', 0) as string; const resource = this.getNodeParameter('resource', 0) as string;
const operation = this.getNodeParameter('operation', 0) as string; const operation = this.getNodeParameter('operation', 0) as string;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
try {
if (resource === 'calendar') { if (resource === 'calendar') {
//https://developers.google.com/calendar/v3/reference/freebusy/query //https://developers.google.com/calendar/v3/reference/freebusy/query
if (operation === 'availability') { if (operation === 'availability') {
@ -605,6 +606,19 @@ export class GoogleCalendar implements INodeType {
); );
} }
} }
} catch (error) {
if (this.continueOnFail() !== true) {
throw error;
} else {
// Return the actual reason as error
returnData.push(
{
error: error.message,
},
);
continue;
}
}
if (Array.isArray(responseData)) { if (Array.isArray(responseData)) {
returnData.push.apply(returnData, responseData as IDataObject[]); returnData.push.apply(returnData, responseData as IDataObject[]);