mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-04 02:37:46 +02:00
25 lines
650 B
TypeScript
25 lines
650 B
TypeScript
import {
|
|
type IRunExecutionData,
|
|
type IWorkflowExecuteAdditionalData,
|
|
UnexpectedError,
|
|
type Workflow,
|
|
type WorkflowExecuteMode,
|
|
} from 'n8n-workflow';
|
|
|
|
export function assertExecutionDataExists(
|
|
executionData: IRunExecutionData['executionData'],
|
|
workflow: Workflow,
|
|
additionalData: IWorkflowExecuteAdditionalData,
|
|
mode: WorkflowExecuteMode,
|
|
): asserts executionData is NonNullable<IRunExecutionData['executionData']> {
|
|
if (!executionData) {
|
|
throw new UnexpectedError('Failed to run workflow due to missing execution data', {
|
|
extra: {
|
|
workflowId: workflow.id,
|
|
executionId: additionalData.executionId,
|
|
mode,
|
|
},
|
|
});
|
|
}
|
|
}
|