|
5 | 5 |
|
6 | 6 | import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
7 | 7 | import { Disposable } from 'vs/base/common/lifecycle';
|
8 |
| -import { IExtensionGalleryService, IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement'; |
| 8 | +import { IExtensionGalleryService, IExtensionManagementService, IGalleryExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; |
9 | 9 | import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
10 | 10 | import { IProductService } from 'vs/platform/product/common/productService';
|
11 | 11 | import { IFeaturedExtension } from 'vs/base/common/product';
|
@@ -108,7 +108,12 @@ export class FeaturedExtensionsService extends Disposable implements IFeaturedEx
|
108 | 108 | this.ignoredExtensions.add(extension);
|
109 | 109 | }
|
110 | 110 | else {
|
111 |
| - const galleryExtension = (await this.galleryService.getExtensions([{ id: extension }], CancellationToken.None))[0]; |
| 111 | + let galleryExtension: IGalleryExtension | undefined; |
| 112 | + try { |
| 113 | + galleryExtension = (await this.galleryService.getExtensions([{ id: extension }], CancellationToken.None))[0]; |
| 114 | + } catch (err) { |
| 115 | + continue; |
| 116 | + } |
112 | 117 | if (!await this.extensionManagementService.canInstall(galleryExtension)) {
|
113 | 118 | this.ignoredExtensions.add(extension);
|
114 | 119 | }
|
@@ -176,32 +181,40 @@ export class FeaturedExtensionsService extends Disposable implements IFeaturedEx
|
176 | 181 |
|
177 | 182 | const storageKey = FeaturedExtensionsService.STORAGE_KEY + '.' + extensionId;
|
178 | 183 | this.storageService.remove(storageKey, StorageScope.APPLICATION);
|
179 |
| - |
180 |
| - const galleryExtension = (await this.galleryService.getExtensions([{ id: extensionId }], CancellationToken.None))[0]; |
181 | 184 | let metadata: string | undefined;
|
182 |
| - if (galleryExtension) { |
183 |
| - switch (key) { |
184 |
| - case FeaturedExtensionMetadataType.Title: { |
185 |
| - metadata = galleryExtension.displayName; |
186 |
| - break; |
187 |
| - } |
188 |
| - case FeaturedExtensionMetadataType.Description: { |
189 |
| - metadata = galleryExtension.description; |
190 |
| - break; |
191 |
| - } |
192 |
| - case FeaturedExtensionMetadataType.ImagePath: { |
193 |
| - metadata = galleryExtension.assets.icon?.uri; |
194 |
| - break; |
195 |
| - } |
196 |
| - } |
197 | 185 |
|
198 |
| - this.storageService.store(storageKey, JSON.stringify({ |
199 |
| - title: galleryExtension.displayName, |
200 |
| - description: galleryExtension.description, |
201 |
| - imagePath: galleryExtension.assets.icon?.uri, |
202 |
| - date: new Date().getTime() |
203 |
| - }), StorageScope.APPLICATION, StorageTarget.MACHINE); |
| 186 | + let galleryExtension: IGalleryExtension | undefined; |
| 187 | + try { |
| 188 | + galleryExtension = (await this.galleryService.getExtensions([{ id: extensionId }], CancellationToken.None))[0]; |
| 189 | + } catch (err) { |
| 190 | + } |
| 191 | + |
| 192 | + if (!galleryExtension) { |
| 193 | + return metadata; |
| 194 | + } |
| 195 | + |
| 196 | + switch (key) { |
| 197 | + case FeaturedExtensionMetadataType.Title: { |
| 198 | + metadata = galleryExtension.displayName; |
| 199 | + break; |
| 200 | + } |
| 201 | + case FeaturedExtensionMetadataType.Description: { |
| 202 | + metadata = galleryExtension.description; |
| 203 | + break; |
| 204 | + } |
| 205 | + case FeaturedExtensionMetadataType.ImagePath: { |
| 206 | + metadata = galleryExtension.assets.icon?.uri; |
| 207 | + break; |
| 208 | + } |
204 | 209 | }
|
| 210 | + |
| 211 | + this.storageService.store(storageKey, JSON.stringify({ |
| 212 | + title: galleryExtension.displayName, |
| 213 | + description: galleryExtension.description, |
| 214 | + imagePath: galleryExtension.assets.icon?.uri, |
| 215 | + date: new Date().getTime() |
| 216 | + }), StorageScope.APPLICATION, StorageTarget.MACHINE); |
| 217 | + |
205 | 218 | return metadata;
|
206 | 219 | }
|
207 | 220 | }
|
|
0 commit comments