mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Improve UX on permission errors (no-changelog) (#13795)
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a12935d724
commit
ca9e62bdc0
62
packages/cli/src/executions/execution-data.service.ts
Normal file
62
packages/cli/src/executions/execution-data.service.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { Service } from '@n8n/di';
|
||||
import type { ExecutionError, INode, IRun, WorkflowExecuteMode } from 'n8n-workflow';
|
||||
|
||||
@Service()
|
||||
export class ExecutionDataService {
|
||||
generateFailedExecutionFromError(
|
||||
mode: WorkflowExecuteMode,
|
||||
error: ExecutionError,
|
||||
node: INode | undefined,
|
||||
startTime = Date.now(),
|
||||
): IRun {
|
||||
const executionError = {
|
||||
...error,
|
||||
message: error.message,
|
||||
stack: error.stack,
|
||||
};
|
||||
const returnData: IRun = {
|
||||
data: {
|
||||
resultData: {
|
||||
error: executionError,
|
||||
runData: {},
|
||||
},
|
||||
},
|
||||
finished: false,
|
||||
mode,
|
||||
startedAt: new Date(),
|
||||
stoppedAt: new Date(),
|
||||
status: 'error',
|
||||
};
|
||||
|
||||
if (node) {
|
||||
returnData.data.startData = {
|
||||
destinationNode: node.name,
|
||||
runNodeFilter: [node.name],
|
||||
};
|
||||
returnData.data.resultData.lastNodeExecuted = node.name;
|
||||
returnData.data.resultData.runData[node.name] = [
|
||||
{
|
||||
startTime,
|
||||
executionTime: 0,
|
||||
executionStatus: 'error',
|
||||
error: executionError,
|
||||
source: [],
|
||||
},
|
||||
];
|
||||
returnData.data.executionData = {
|
||||
contextData: {},
|
||||
metadata: {},
|
||||
waitingExecution: {},
|
||||
waitingExecutionSource: {},
|
||||
nodeExecutionStack: [
|
||||
{
|
||||
node,
|
||||
data: {},
|
||||
source: null,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user