mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
add error handling for unknon operations
This commit is contained in:
@@ -1026,6 +1026,8 @@ export class ActiveCampaign implements INodeType {
|
|||||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||||
addAdditionalFields(body.contact as IDataObject, updateFields);
|
addAdditionalFields(body.contact as IDataObject, updateFields);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new Error(`The operation ${operation} is not known`);
|
||||||
}
|
}
|
||||||
} else if (resource === 'deal') {
|
} else if (resource === 'deal') {
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
@@ -1102,23 +1104,26 @@ export class ActiveCampaign implements INodeType {
|
|||||||
dataKey = 'deals';
|
dataKey = 'deals';
|
||||||
endpoint = `/api/3/deals`;
|
endpoint = `/api/3/deals`;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`The resource "${resource}" is not known!`);
|
throw new Error(`The operation ${operation} is not known`);
|
||||||
}
|
|
||||||
|
|
||||||
let responseData;
|
|
||||||
if (returnAll === true) {
|
|
||||||
responseData = await activeCampaignApiRequestAllItems.call(this, requestMethod, endpoint, body, qs, dataKey);
|
|
||||||
} else {
|
|
||||||
responseData = await activeCampaignApiRequest.call(this, requestMethod, endpoint, body, qs, dataKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.isArray(responseData)) {
|
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
|
||||||
} else {
|
|
||||||
returnData.push(responseData as IDataObject);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new Error(`The resource "${resource}" is not known!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
let responseData;
|
||||||
|
if (returnAll === true) {
|
||||||
|
responseData = await activeCampaignApiRequestAllItems.call(this, requestMethod, endpoint, body, qs, dataKey);
|
||||||
|
} else {
|
||||||
|
responseData = await activeCampaignApiRequest.call(this, requestMethod, endpoint, body, qs, dataKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(responseData)) {
|
||||||
|
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||||
|
} else {
|
||||||
|
returnData.push(responseData as IDataObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return [this.helpers.returnJsonArray(returnData)];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user