mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
chore: Convert ErrorReporting to a Service to use DI. Add some tests (no-changelog) (#11279)
This commit is contained in:
committed by
GitHub
parent
5300e0ac45
commit
73145b70b8
@@ -5,6 +5,7 @@
|
||||
import * as a from 'assert/strict';
|
||||
import {
|
||||
DirectedGraph,
|
||||
ErrorReporter,
|
||||
InstanceSettings,
|
||||
WorkflowExecute,
|
||||
filterDisabledNodes,
|
||||
@@ -22,11 +23,7 @@ import type {
|
||||
IRunExecutionData,
|
||||
IWorkflowExecuteAdditionalData,
|
||||
} from 'n8n-workflow';
|
||||
import {
|
||||
ErrorReporterProxy as ErrorReporter,
|
||||
ExecutionCancelledError,
|
||||
Workflow,
|
||||
} from 'n8n-workflow';
|
||||
import { ExecutionCancelledError, Workflow } from 'n8n-workflow';
|
||||
import PCancelable from 'p-cancelable';
|
||||
import { Container, Service } from 'typedi';
|
||||
|
||||
@@ -55,6 +52,7 @@ export class WorkflowRunner {
|
||||
|
||||
constructor(
|
||||
private readonly logger: Logger,
|
||||
private readonly errorReporter: ErrorReporter,
|
||||
private readonly activeExecutions: ActiveExecutions,
|
||||
private readonly executionRepository: ExecutionRepository,
|
||||
private readonly externalHooks: ExternalHooks,
|
||||
@@ -82,7 +80,7 @@ export class WorkflowRunner {
|
||||
return;
|
||||
}
|
||||
|
||||
ErrorReporter.error(error, { executionId });
|
||||
this.errorReporter.error(error, { executionId });
|
||||
|
||||
const isQueueMode = config.getEnv('executions.mode') === 'queue';
|
||||
|
||||
@@ -193,14 +191,14 @@ export class WorkflowRunner {
|
||||
executionId,
|
||||
]);
|
||||
} catch (error) {
|
||||
ErrorReporter.error(error);
|
||||
this.errorReporter.error(error);
|
||||
this.logger.error('There was a problem running hook "workflow.postExecute"', error);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error instanceof ExecutionCancelledError) return;
|
||||
ErrorReporter.error(error);
|
||||
this.errorReporter.error(error);
|
||||
this.logger.error(
|
||||
'There was a problem running internal hook "onWorkflowPostExecute"',
|
||||
error,
|
||||
|
||||
Reference in New Issue
Block a user