Add extra catch around package manager

This commit is contained in:
Matt Bierner
2025-03-12 16:58:50 -07:00
parent df6adbae7c
commit b61d46c3e4

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { PackageManager } from '@vscode/ts-package-manager';
import { PackageManager, ResolvedProject } from '@vscode/ts-package-manager';
import { basename, join } from 'path';
import * as vscode from 'vscode';
import { URI } from 'vscode-uri';
@@ -161,12 +161,18 @@ export class AutoInstallerFs extends Disposable implements vscode.FileSystemProv
}
const installing = (async () => {
const proj = await this.packageManager.resolveProject(root, await this.getInstallOpts(incomingUri.original, root));
let proj: ResolvedProject;
try {
proj = await this.packageManager.resolveProject(root, await this.getInstallOpts(incomingUri.original, root));
} catch (e) {
console.error(`failed to resolve project at ${incomingUri.path}: `, e);
return;
}
try {
await proj.restore();
} catch (e) {
console.error(`failed to restore package at ${incomingUri.path}: `, e);
throw e;
}
})();
this._projectCache.set(root, installing);