CLI: bail out when profile does not exist (#171646)

This commit is contained in:
Sandeep Somavarapu
2023-01-18 18:57:43 +01:00
committed by GitHub
parent 054a2e7f9d
commit a3b2f85ba4
+9 -2
View File
@@ -58,7 +58,7 @@ import { OneDataSystemAppender } from 'vs/platform/telemetry/node/1dsAppender';
import { buildTelemetryMessage } from 'vs/platform/telemetry/node/telemetry';
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
import { UriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentityService';
import { IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile';
import { IUserDataProfile, IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile';
import { UserDataProfilesService } from 'vs/platform/userDataProfile/node/userDataProfile';
import { resolveMachineId } from 'vs/platform/telemetry/node/telemetryUtils';
import { ExtensionsProfileScannerService } from 'vs/platform/extensionManagement/node/extensionsProfileScannerService';
@@ -251,7 +251,14 @@ class CliMain extends Disposable {
}
private async doRun(environmentService: INativeEnvironmentService, fileService: IFileService, userDataProfilesService: IUserDataProfilesService, instantiationService: IInstantiationService): Promise<void> {
const profileLocation = (environmentService.args.profile ? userDataProfilesService.profiles.find(p => p.name === environmentService.args.profile) ?? userDataProfilesService.defaultProfile : userDataProfilesService.defaultProfile).extensionsResource;
let profile: IUserDataProfile | undefined = undefined;
if (environmentService.args.profile) {
profile = userDataProfilesService.profiles.find(p => p.name === environmentService.args.profile);
if (!profile) {
throw new Error(`Profile '${environmentService.args.profile}' not found.`);
}
}
const profileLocation = (profile ?? userDataProfilesService.defaultProfile).extensionsResource;
// Install Source
if (this.argv['install-source']) {