refactor(core): Reorganize error hierarchy in cli package (no-changelog) (#7839)
Ensure all errors in `cli` inherit from `ApplicationError` to continue normalizing all the errors we report to Sentry Follow-up to: https://github.com/n8n-io/n8n/pull/7820
This commit is contained in:
@@ -117,6 +117,8 @@ import { OrchestrationController } from './controllers/orchestration.controller'
|
||||
import { WorkflowHistoryController } from './workflows/workflowHistory/workflowHistory.controller.ee';
|
||||
import { InvitationController } from './controllers/invitation.controller';
|
||||
import { CollaborationService } from './collaboration/collaboration.service';
|
||||
import { BadRequestError } from './errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from './errors/response-errors/not-found.error';
|
||||
|
||||
const exec = promisify(callbackExec);
|
||||
|
||||
@@ -466,9 +468,7 @@ export class Server extends AbstractServer {
|
||||
userId: req.user.id,
|
||||
});
|
||||
|
||||
throw new ResponseHelper.BadRequestError(
|
||||
`Workflow with ID "${workflowId}" could not be found.`,
|
||||
);
|
||||
throw new BadRequestError(`Workflow with ID "${workflowId}" could not be found.`);
|
||||
}
|
||||
|
||||
return this.activeWorkflowRunner.getActivationError(workflowId);
|
||||
@@ -491,7 +491,7 @@ export class Server extends AbstractServer {
|
||||
const parameters = toHttpNodeParameters(curlCommand);
|
||||
return ResponseHelper.flattenObject(parameters, 'parameters');
|
||||
} catch (e) {
|
||||
throw new ResponseHelper.BadRequestError('Invalid cURL command');
|
||||
throw new BadRequestError('Invalid cURL command');
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -624,7 +624,7 @@ export class Server extends AbstractServer {
|
||||
const sharedWorkflowIds = await getSharedWorkflowIds(req.user);
|
||||
|
||||
if (!sharedWorkflowIds.length) {
|
||||
throw new ResponseHelper.NotFoundError('Execution not found');
|
||||
throw new NotFoundError('Execution not found');
|
||||
}
|
||||
|
||||
const fullExecutionData = await Container.get(ExecutionRepository).findSingleExecution(
|
||||
@@ -637,7 +637,7 @@ export class Server extends AbstractServer {
|
||||
);
|
||||
|
||||
if (!fullExecutionData) {
|
||||
throw new ResponseHelper.NotFoundError('Execution not found');
|
||||
throw new NotFoundError('Execution not found');
|
||||
}
|
||||
|
||||
if (config.getEnv('executions.mode') === 'queue') {
|
||||
|
||||
Reference in New Issue
Block a user