From 916f7677fceedc80bfa3dbc037daddb78e949b01 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 28 Jul 2022 06:23:17 +0200 Subject: Fix #156321 (#156524) --- .../userDataProfile/common/userDataProfileActions.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/vs') diff --git a/src/vs/workbench/contrib/userDataProfile/common/userDataProfileActions.ts b/src/vs/workbench/contrib/userDataProfile/common/userDataProfileActions.ts index f1d27222b50..62e3de604fe 100644 --- a/src/vs/workbench/contrib/userDataProfile/common/userDataProfileActions.ts +++ b/src/vs/workbench/contrib/userDataProfile/common/userDataProfileActions.ts @@ -375,6 +375,7 @@ registerAction2(class ImportProfileAction extends Action2 { const userDataProfileImportExportService = accessor.get(IUserDataProfileImportExportService); const dialogService = accessor.get(IDialogService); const contextKeyService = accessor.get(IContextKeyService); + const notificationService = accessor.get(INotificationService); const isSettingProfilesEnabled = contextKeyService.contextMatchesRules(PROFILES_ENABLEMENT_CONTEXT); @@ -401,14 +402,18 @@ registerAction2(class ImportProfileAction extends Action2 { quickPick.matchOnLabel = false; quickPick.matchOnDescription = false; disposables.add(quickPick.onDidAccept(async () => { - quickPick.hide(); - const profile = quickPick.selectedItems[0].description ? await this.getProfileFromURL(quickPick.value, requestService) : await this.getProfileFromFileSystem(fileDialogService, fileService); - if (profile) { - if (isSettingProfilesEnabled) { - await userDataProfileImportExportService.importProfile(profile); - } else { - await userDataProfileImportExportService.setProfile(profile); + try { + quickPick.hide(); + const profile = quickPick.selectedItems[0].description ? await this.getProfileFromURL(quickPick.value, requestService) : await this.getProfileFromFileSystem(fileDialogService, fileService); + if (profile) { + if (isSettingProfilesEnabled) { + await userDataProfileImportExportService.importProfile(profile); + } else { + await userDataProfileImportExportService.setProfile(profile); + } } + } catch (error) { + notificationService.error(error); } })); disposables.add(quickPick.onDidHide(() => disposables.dispose())); -- cgit v1.2.3