diff --git a/src/vs/workbench/api/browser/mainThreadExtensionService.ts b/src/vs/workbench/api/browser/mainThreadExtensionService.ts index 8bbedafd7ae..e918f18faf2 100644 --- a/src/vs/workbench/api/browser/mainThreadExtensionService.ts +++ b/src/vs/workbench/api/browser/mainThreadExtensionService.ts @@ -15,7 +15,7 @@ import { Action } from 'vs/base/common/actions'; import { IWorkbenchExtensionEnablementService, EnablementState } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { IHostService } from 'vs/workbench/services/host/browser/host'; -import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtension, IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; import { CancellationToken } from 'vs/base/common/cancellation'; import { ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionActivationReason } from 'vs/workbench/api/common/extHostExtensionActivator'; @@ -106,14 +106,18 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha private async _handleMissingNotInstalledDependency(extension: IExtensionDescription, missingDependency: string): Promise { const extName = extension.displayName || extension.name; - const dependencyExtension = (await this._extensionsWorkbenchService.queryGallery({ names: [missingDependency] }, CancellationToken.None)).firstPage[0]; + let dependencyExtension: IExtension | null = null; + try { + dependencyExtension = (await this._extensionsWorkbenchService.queryGallery({ names: [missingDependency] }, CancellationToken.None)).firstPage[0]; + } catch (err) { + } if (dependencyExtension) { this._notificationService.notify({ severity: Severity.Error, message: localize('uninstalledDep', "Cannot activate the '{0}' extension because it depends on the '{1}' extension, which is not installed. Would you like to install the extension and reload the window?", extName, dependencyExtension.displayName), actions: { primary: [new Action('install', localize('install missing dep', "Install and Reload"), '', true, - () => this._extensionsWorkbenchService.install(dependencyExtension) + () => this._extensionsWorkbenchService.install(dependencyExtension!) .then(() => this._hostService.reload(), e => this._notificationService.error(e)))] } });