mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat(Google Workspace Admin Node): Add support for error output branch (#8499)
This commit is contained in:
parent
2068f186ff
commit
ef775711d0
|
@ -115,6 +115,7 @@ export class GSuiteAdmin implements INodeType {
|
|||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
if (resource === 'group') {
|
||||
//https://developers.google.com/admin-sdk/directory/v1/reference/groups/insert
|
||||
if (operation === 'create') {
|
||||
|
@ -181,7 +182,13 @@ export class GSuiteAdmin implements INodeType {
|
|||
} else {
|
||||
qs.maxResults = this.getNodeParameter('limit', i);
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'GET', '/directory/v1/groups', {}, qs);
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/directory/v1/groups',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
responseData = responseData.groups;
|
||||
}
|
||||
|
@ -250,7 +257,13 @@ export class GSuiteAdmin implements INodeType {
|
|||
delete body.emailUi;
|
||||
}
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'POST', '/directory/v1/users', body, qs);
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/directory/v1/users',
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
|
||||
if (makeAdmin) {
|
||||
await googleApiRequest.call(
|
||||
|
@ -351,7 +364,13 @@ export class GSuiteAdmin implements INodeType {
|
|||
} else {
|
||||
qs.maxResults = this.getNodeParameter('limit', i);
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'GET', '/directory/v1/users', {}, qs);
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/directory/v1/users',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
responseData = responseData.users;
|
||||
}
|
||||
|
@ -422,8 +441,18 @@ export class GSuiteAdmin implements INodeType {
|
|||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue