mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
⚡ Add preExecuteHooks (#1151)
* ⚡ Save initital data on hook error * 🚧 update function interface * 🚧 response webhook with error, 🐛 fix adding preExecutionHooks to hooks * 🔥 remove execute hook * ⚡ execute preExecute hooks on integrated workflows Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -468,7 +468,6 @@ export class WorkflowExecute {
|
||||
this.runExecutionData.startData = {};
|
||||
}
|
||||
|
||||
this.executeHook('workflowExecuteBefore', []);
|
||||
|
||||
let currentExecutionTry = '';
|
||||
let lastExecutionTry = '';
|
||||
@@ -482,6 +481,35 @@ export class WorkflowExecute {
|
||||
});
|
||||
|
||||
const returnPromise = (async () => {
|
||||
try {
|
||||
await this.executeHook('workflowExecuteBefore', [workflow]);
|
||||
} catch (error) {
|
||||
// Set the error that it can be saved correctly
|
||||
executionError = {
|
||||
message: error.message,
|
||||
stack: error.stack,
|
||||
};
|
||||
|
||||
// Set the incoming data of the node that it can be saved correctly
|
||||
executionData = this.runExecutionData.executionData!.nodeExecutionStack[0] as IExecuteData;
|
||||
this.runExecutionData.resultData = {
|
||||
runData: {
|
||||
[executionData.node.name]: [
|
||||
{
|
||||
startTime,
|
||||
executionTime: (new Date().getTime()) - startTime,
|
||||
data: ({
|
||||
'main': executionData.data.main,
|
||||
} as ITaskDataConnections),
|
||||
},
|
||||
],
|
||||
},
|
||||
lastNodeExecuted: executionData.node.name,
|
||||
error: executionError,
|
||||
};
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
executionLoop:
|
||||
while (this.runExecutionData.executionData!.nodeExecutionStack.length !== 0) {
|
||||
|
||||
Reference in New Issue
Block a user