Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: more descriptive error message when ado extension fail #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/generators/azuredevops/generator/ExtensionGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class ExtensionGenerator implements IGenerator<{ publisher: strin
public async generate() {
const installedExtensions = await this.conn.getInstalledExtensions();

const uninstalledEntensions = extensions.filter((extension) => {
const uninstalledExtensions = extensions.filter((extension) => {
const installed = installedExtensions
// eslint-disable-next-line max-len
.find((ext) => ext.extensionId === extension.name && ext.publisherId === extension.publisher) !== undefined;
Expand All @@ -34,10 +34,16 @@ export default class ExtensionGenerator implements IGenerator<{ publisher: strin
return !installed;
});

const installPromises: Array<Promise<void> | undefined> = uninstalledEntensions
const installPromises: Array<Promise<void> | undefined> = uninstalledExtensions
.map((extension) => this.installExtension(extension.publisher, extension.name));

await Promise.all(installPromises);
try {
await Promise.all(installPromises);
} catch (e) {
this.log('Installing extensions failed. This is likely due to your user (who generated the PAC token) not having permissions to install extensions into this organisation. Please request the following extensions and wait for the install.');
uninstalledExtensions.forEach((x) => this.log(`- https://marketplace.visualstudio.com/items?itemName=${x.publisher}.${x.name}`));
throw e;
}

if (installPromises.length > 0) {
this.log('Waiting 1 minute for the extension(s) to fully install.');
Expand Down