Skip to content

Commit

Permalink
refactor(core): Stop reporting to Sentry unrecognized node errors (no…
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov authored Nov 17, 2023
1 parent b4ebb1a commit 0408299
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/12-canvas.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,20 +390,20 @@ describe('Canvas Node Manipulation and Navigation', () => {
);

WorkflowPage.actions.executeWorkflow();
cy.contains('Node not found').should('be.visible');
cy.contains('Unrecognized node type').should('be.visible');

WorkflowPage.getters
.canvasNodeByName(`${unknownNodeName} 1`)
.find('[data-test-id=delete-node-button]')
.click({ force: true });

WorkflowPage.getters
WorkflowPage.getters
.canvasNodeByName(`${unknownNodeName} 2`)
.find('[data-test-id=delete-node-button]')
.click({ force: true });

WorkflowPage.actions.executeWorkflow();

cy.contains('Node not found').should('not.exist');
cy.contains('Unrecognized node type').should('not.exist');
});
});
12 changes: 10 additions & 2 deletions packages/cli/src/NodeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ import type {
} from 'n8n-workflow';
import { NodeHelpers } from 'n8n-workflow';
import { Service } from 'typedi';
import { RESPONSE_ERROR_MESSAGES } from './constants';
import { LoadNodesAndCredentials } from './LoadNodesAndCredentials';
import { join, dirname } from 'path';
import { readdir } from 'fs/promises';
import type { Dirent } from 'fs';

class UnrecognizedNodeError extends Error {
severity = 'warning';

constructor(nodeType: string) {
super(`Unrecognized node type: ${nodeType}".`);
}
}

@Service()
export class NodeTypes implements INodeTypes {
constructor(private loadNodesAndCredentials: LoadNodesAndCredentials) {
Expand Down Expand Up @@ -67,7 +74,8 @@ export class NodeTypes implements INodeTypes {
loadedNodes[type] = { sourcePath, type: loaded };
return loadedNodes[type];
}
throw new Error(`${RESPONSE_ERROR_MESSAGES.NO_NODE}: ${type}`);

throw new UnrecognizedNodeError(type);
}

async getNodeTranslationPath({
Expand Down

0 comments on commit 0408299

Please sign in to comment.