mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
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:
@@ -2,7 +2,7 @@ import type { SourceControlledFile } from '@n8n/api-types';
|
||||
import { Service } from '@n8n/di';
|
||||
import { rmSync } from 'fs';
|
||||
import { Credentials, InstanceSettings, Logger } from 'n8n-core';
|
||||
import { ApplicationError, type ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||
import { UnexpectedError, type ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||
import { writeFile as fsWriteFile, rm as fsRm } from 'node:fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
@@ -120,7 +120,7 @@ export class SourceControlExportService {
|
||||
const project = sharedWorkflow.project;
|
||||
|
||||
if (!project) {
|
||||
throw new ApplicationError(
|
||||
throw new UnexpectedError(
|
||||
`Workflow ${formatWorkflow(sharedWorkflow.workflow)} has no owner`,
|
||||
);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ export class SourceControlExportService {
|
||||
(pr) => pr.role === 'project:personalOwner',
|
||||
);
|
||||
if (!ownerRelation) {
|
||||
throw new ApplicationError(
|
||||
throw new UnexpectedError(
|
||||
`Workflow ${formatWorkflow(sharedWorkflow.workflow)} has no owner`,
|
||||
);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ export class SourceControlExportService {
|
||||
teamName: project.name,
|
||||
};
|
||||
} else {
|
||||
throw new ApplicationError(
|
||||
throw new UnexpectedError(
|
||||
`Workflow belongs to unknown project type: ${project.type as string}`,
|
||||
);
|
||||
}
|
||||
@@ -164,8 +164,8 @@ export class SourceControlExportService {
|
||||
})),
|
||||
};
|
||||
} catch (error) {
|
||||
if (error instanceof ApplicationError) throw error;
|
||||
throw new ApplicationError('Failed to export workflows to work folder', { cause: error });
|
||||
if (error instanceof UnexpectedError) throw error;
|
||||
throw new UnexpectedError('Failed to export workflows to work folder', { cause: error });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ export class SourceControlExportService {
|
||||
],
|
||||
};
|
||||
} catch (error) {
|
||||
throw new ApplicationError('Failed to export variables to work folder', {
|
||||
throw new UnexpectedError('Failed to export variables to work folder', {
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
@@ -237,7 +237,7 @@ export class SourceControlExportService {
|
||||
],
|
||||
};
|
||||
} catch (error) {
|
||||
throw new ApplicationError('Failed to export variables to work folder', { cause: error });
|
||||
throw new UnexpectedError('Failed to export variables to work folder', { cause: error });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ export class SourceControlExportService {
|
||||
missingIds,
|
||||
};
|
||||
} catch (error) {
|
||||
throw new ApplicationError('Failed to export credentials to work folder', { cause: error });
|
||||
throw new UnexpectedError('Failed to export credentials to work folder', { cause: error });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user