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:
Iván Ovejero
2023-11-28 10:19:27 +01:00
committed by GitHub
parent 38f24a6184
commit 1c6178759c
81 changed files with 346 additions and 297 deletions

View File

@@ -40,6 +40,7 @@ import type { IConfig } from '@oclif/config';
import { OrchestrationHandlerWorkerService } from '@/services/orchestration/worker/orchestration.handler.worker.service';
import { OrchestrationWorkerService } from '@/services/orchestration/worker/orchestration.worker.service';
import type { WorkerJobStatusSummary } from '../services/orchestration/worker/types';
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
export class Worker extends BaseCommand {
static description = '\nStarts a n8n worker';
@@ -413,7 +414,7 @@ export class Worker extends BaseCommand {
await connection.query('SELECT 1');
} catch (e) {
this.logger.error('No Database connection!', e as Error);
const error = new ResponseHelper.ServiceUnavailableError('No Database connection!');
const error = new ServiceUnavailableError('No Database connection!');
return ResponseHelper.sendErrorResponse(res, error);
}
@@ -424,7 +425,7 @@ export class Worker extends BaseCommand {
await Worker.jobQueue.ping();
} catch (e) {
this.logger.error('No Redis connection!', e as Error);
const error = new ResponseHelper.ServiceUnavailableError('No Redis connection!');
const error = new ServiceUnavailableError('No Redis connection!');
return ResponseHelper.sendErrorResponse(res, error);
}