refactor(core): Migrate all errors in cli package to new hierarchy (#13478)

Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
This commit is contained in:
Iván Ovejero
2025-02-27 08:30:55 +01:00
committed by GitHub
parent 719e3c2cf7
commit 3ca99194c6
107 changed files with 340 additions and 354 deletions

View File

@@ -21,7 +21,7 @@ import type {
ILocalLoadOptionsFunctions,
IExecuteData,
} from 'n8n-workflow';
import { Workflow, ApplicationError } from 'n8n-workflow';
import { Workflow, UnexpectedError } from 'n8n-workflow';
import { NodeTypes } from '@/node-types';
@@ -91,7 +91,7 @@ export class DynamicNodeParametersService {
// requiring a baseURL to be defined can at least not a random server be called.
// In the future this code has to get improved that it does not use the request information from
// the request rather resolves it via the parameter-path and nodeType data.
throw new ApplicationError(
throw new UnexpectedError(
'Node type does not exist or does not have "requestDefaults.baseURL" defined!',
{ tags: { nodeType: nodeType.description.name } },
);
@@ -152,7 +152,7 @@ export class DynamicNodeParametersService {
}
if (!Array.isArray(optionsData)) {
throw new ApplicationError('The returned data is not an array');
throw new UnexpectedError('The returned data is not an array');
}
return optionsData[0].map((item) => item.json) as unknown as INodePropertyOptions[];
@@ -258,7 +258,7 @@ export class DynamicNodeParametersService {
): NodeMethod {
const method = nodeType.methods?.[type]?.[methodName] as NodeMethod;
if (typeof method !== 'function') {
throw new ApplicationError('Node type does not have method defined', {
throw new UnexpectedError('Node type does not have method defined', {
tags: { nodeType: nodeType.description.name },
extra: { methodName },
});