mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31: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:
@@ -35,6 +35,7 @@ import { InternalHooks } from '@/InternalHooks';
|
||||
import { TagRepository } from '@db/repositories/tag.repository';
|
||||
import { Logger } from '@/Logger';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
@Service()
|
||||
export class SourceControlService {
|
||||
@@ -83,7 +84,7 @@ export class SourceControlService {
|
||||
false,
|
||||
);
|
||||
if (!foldersExisted) {
|
||||
throw new Error();
|
||||
throw new ApplicationError('No folders exist');
|
||||
}
|
||||
if (!this.gitService.git) {
|
||||
await this.initGitService();
|
||||
@@ -94,7 +95,7 @@ export class SourceControlService {
|
||||
branches.current !==
|
||||
this.sourceControlPreferencesService.sourceControlPreferences.branchName
|
||||
) {
|
||||
throw new Error();
|
||||
throw new ApplicationError('Branch is not set up correctly');
|
||||
}
|
||||
} catch (error) {
|
||||
throw new BadRequestError(
|
||||
@@ -195,7 +196,7 @@ export class SourceControlService {
|
||||
await this.gitService.pull();
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to reset workfolder: ${(error as Error).message}`);
|
||||
throw new Error(
|
||||
throw new ApplicationError(
|
||||
'Unable to fetch updates from git - your folder might be out of sync. Try reconnecting from the Source Control settings page.',
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user