Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion credentials/ITGlueApi.credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ import {
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
type Icon,
} from 'n8n-workflow';

export class ITGlueApi implements ICredentialType {
name = 'itglueApi';
displayName = 'IT Glue API';
icon: Icon = {
light: 'file:itglue.svg',
dark: 'file:itglue-dark.svg',
};
documentationUrl = 'https://github.com/redanthrax/itglue-node';
properties: INodeProperties[] = [
{
Expand Down
1 change: 1 addition & 0 deletions credentials/itglue-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions credentials/itglue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion nodes/ITGlue/ITGlue.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export class ITGlue implements INodeType {
description: INodeTypeDescription = {
displayName: 'IT Glue',
name: 'iTGlue',
icon: 'file:itglue.svg',
icon: {
light: 'file:itglue.svg',
dark: 'file:itglue-dark.svg',
},
group: ['transform'],
version: 1,
documentationUrl: 'https://github.com/redanthrax/itglue-node',
Expand Down
19 changes: 14 additions & 5 deletions nodes/ITGlue/actions/organization/bulkUpdate/execute.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { IDataObject, IExecuteFunctions, INodeExecutionData } from "n8n-workflow";
import { itglueRequest } from "../../../transport";
import {
IDataObject,
IExecuteFunctions,
INodeExecutionData,
NodeOperationError,
} from 'n8n-workflow';
import { itglueRequest } from '../../../transport';

export async function bulkUpdateOrganizations(
this: IExecuteFunctions,
Expand All @@ -14,12 +19,16 @@ export async function bulkUpdateOrganizations(

try {
organizationsData = JSON.parse(organizations);
} catch (error) {
throw new Error('Invalid JSON format for organizations data');
} catch {
throw new NodeOperationError(this.getNode(), 'Invalid JSON format for organizations data', {
itemIndex: index,
});
}

if (!Array.isArray(organizationsData)) {
throw new Error('Organizations data must be an array');
throw new NodeOperationError(this.getNode(), 'Organizations data must be an array', {
itemIndex: index,
});
}

// Transform the data to IT Glue API format
Expand Down
13 changes: 11 additions & 2 deletions nodes/ITGlue/actions/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import {
IDataObject,
IExecuteFunctions,
INodeExecutionData,
type JsonObject,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';

import { ITGlue } from './interfaces';
Expand Down Expand Up @@ -298,8 +301,14 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
if (this.continueOnFail()) {
operationResult.push({ json: this.getInputData(i)[0].json, error: err, pairedItem: i });
} else {
if (err.context) err.context.itemIndex = i;
throw err;
if (err instanceof NodeApiError || err instanceof NodeOperationError) {
err.context.itemIndex = i;
throw err;
}

throw new NodeApiError(this.getNode(), err as JsonObject, {
itemIndex: i,
});
}
}
}
Expand Down
1 change: 1 addition & 0 deletions nodes/ITGlue/itglue-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion nodes/ITGlue/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
IHttpRequestOptions,
ILoadOptionsFunctions,
IPollFunctions,
type JsonObject,
NodeOperationError,
NodeApiError,
} from 'n8n-workflow';
Expand Down Expand Up @@ -56,7 +57,7 @@ export async function itglueRequest(
'Rate limit exceeded. IT Glue is throttling requests. Please try again later.',
);
}
throw error;
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8n-nodes-itglue",
"version": "2.2.2",
"version": "2.2.3",
"description": "An n8n node to connect to IT Glue",
"keywords": [
"n8n-nodes-itglue",
Expand Down
Loading