mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
refactor(core): Switch plain errors in cli to ApplicationError (#7857)
Ensure all errors in `cli` are `ApplicationError` or children of it and contain no variables in the message, to continue normalizing all the errors we report to Sentry Follow-up to: https://github.com/n8n-io/n8n/pull/7839
This commit is contained in:
@@ -26,6 +26,7 @@ import type {
|
||||
ExecutionError,
|
||||
} from 'n8n-workflow';
|
||||
import {
|
||||
ApplicationError,
|
||||
ErrorReporterProxy as ErrorReporter,
|
||||
NodeOperationError,
|
||||
Workflow,
|
||||
@@ -679,7 +680,7 @@ export async function getWorkflowData(
|
||||
parentWorkflowSettings?: IWorkflowSettings,
|
||||
): Promise<IWorkflowBase> {
|
||||
if (workflowInfo.id === undefined && workflowInfo.code === undefined) {
|
||||
throw new Error(
|
||||
throw new ApplicationError(
|
||||
'No information about the workflow to execute found. Please provide either the "id" or "code"!',
|
||||
);
|
||||
}
|
||||
@@ -691,7 +692,9 @@ export async function getWorkflowData(
|
||||
workflowData = await WorkflowsService.get({ id: workflowInfo.id }, { relations });
|
||||
|
||||
if (workflowData === undefined || workflowData === null) {
|
||||
throw new Error(`The workflow with the id "${workflowInfo.id}" does not exist.`);
|
||||
throw new ApplicationError('Workflow does not exist.', {
|
||||
extra: { workflowId: workflowInfo.id },
|
||||
});
|
||||
}
|
||||
} else {
|
||||
workflowData = workflowInfo.code ?? null;
|
||||
|
||||
Reference in New Issue
Block a user