🐛 Swallow telemetry error and only log in warn and debug mode (#2858)
* catch nodegraph errors * use loglevel config for telemetry * Use getByNameAndVersion instead of getByName * remove any usage of nodeTypes.getByName method * deprecate getByName method
This commit is contained in:
@@ -54,13 +54,6 @@ const mockNodeTypes: INodeTypes = {
|
||||
// @ts-ignore
|
||||
return Object.values(this.nodeTypes).map((data) => data.type);
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
getByName(nodeType: string): INodeType | INodeVersionedType | undefined {
|
||||
if (this.nodeTypes[nodeType] === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return this.nodeTypes[nodeType].type;
|
||||
},
|
||||
getByNameAndVersion(nodeType: string, version?: number): INodeType | undefined {
|
||||
if (this.nodeTypes[nodeType] === undefined) {
|
||||
return undefined;
|
||||
@@ -524,7 +517,7 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||
nodeType = credentialTestFunction.nodeType;
|
||||
} else {
|
||||
const nodeTypes = NodeTypes();
|
||||
nodeType = nodeTypes.getByName('n8n-nodes-base.noOp') as INodeType;
|
||||
nodeType = nodeTypes.getByNameAndVersion('n8n-nodes-base.noOp');
|
||||
}
|
||||
|
||||
const node: INode = {
|
||||
|
||||
@@ -33,13 +33,6 @@ class NodeTypesClass implements INodeTypes {
|
||||
return Object.values(this.nodeTypes).map((data) => data.type);
|
||||
}
|
||||
|
||||
getByName(nodeType: string): INodeType | INodeVersionedType | undefined {
|
||||
if (this.nodeTypes[nodeType] === undefined) {
|
||||
throw new Error(`The node-type "${nodeType}" is not known!`);
|
||||
}
|
||||
return this.nodeTypes[nodeType].type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of `getByNameAndVersion` that includes the node's source path, used to locate a node's translations.
|
||||
*/
|
||||
|
||||
@@ -58,6 +58,7 @@ export class Telemetry {
|
||||
this.versionCli = versionCli;
|
||||
|
||||
const enabled = config.get('diagnostics.enabled') as boolean;
|
||||
const logLevel = config.get('logs.level') as boolean;
|
||||
if (enabled) {
|
||||
const conf = config.get('diagnostics.config.backend') as string;
|
||||
const [key, url] = conf.split(';');
|
||||
@@ -69,7 +70,7 @@ export class Telemetry {
|
||||
return;
|
||||
}
|
||||
|
||||
this.client = new TelemetryClient(key, url);
|
||||
this.client = new TelemetryClient(key, url, { logLevel });
|
||||
|
||||
this.pulseIntervalReference = setInterval(async () => {
|
||||
void this.pulse();
|
||||
|
||||
Reference in New Issue
Block a user