mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 17:23:21 -05:00
* Fix .NET Install state for error conditions * Address comment- remove redundant constructor Co-authored-by: Sakshi Sharma <57200045+SakshiS-harma@users.noreply.github.com>
This commit is contained in:
@@ -24,7 +24,7 @@ import { IDeploySettings } from '../models/IDeploySettings';
|
||||
import { BaseProjectTreeItem } from '../models/tree/baseTreeItem';
|
||||
import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
|
||||
import { ImportDataModel } from '../models/api/import';
|
||||
import { NetCoreTool, DotNetCommandOptions } from '../tools/netcoreTool';
|
||||
import { NetCoreTool, DotNetCommandOptions, DotNetError } from '../tools/netcoreTool';
|
||||
import { BuildHelper } from '../tools/buildHelper';
|
||||
import { readPublishProfile } from '../models/publishProfile/publishProfile';
|
||||
import { AddDatabaseReferenceDialog } from '../dialogs/addDatabaseReferenceDialog';
|
||||
@@ -238,9 +238,11 @@ export class ProjectsController {
|
||||
.withAdditionalMeasurements({ duration: timeToFailureBuild })
|
||||
.send();
|
||||
|
||||
const error = utils.getErrorMessage(err);
|
||||
if (error !== (constants.NetCoreInstallationConfirmation || constants.NetCoreSupportedVersionInstallationConfirmation)) {
|
||||
vscode.window.showErrorMessage(constants.projBuildFailed(error));
|
||||
const message = utils.getErrorMessage(err);
|
||||
if (err instanceof DotNetError) {
|
||||
vscode.window.showErrorMessage(message);
|
||||
} else {
|
||||
vscode.window.showErrorMessage(constants.projBuildFailed(message));
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -148,15 +148,21 @@ export class NetCoreTool {
|
||||
child.on('exit', () => {
|
||||
this.netCoreSdkInstalledVersion = Buffer.concat(stdoutBuffers).toString('utf8').trim();
|
||||
|
||||
if (semver.gte(this.netCoreSdkInstalledVersion, minSupportedNetCoreVersion)) { // Net core version greater than or equal to minSupportedNetCoreVersion are supported for Build
|
||||
isSupported = true;
|
||||
} else {
|
||||
isSupported = false;
|
||||
try {
|
||||
if (semver.gte(this.netCoreSdkInstalledVersion, minSupportedNetCoreVersion)) { // Net core version greater than or equal to minSupportedNetCoreVersion are supported for Build
|
||||
isSupported = true;
|
||||
} else {
|
||||
isSupported = false;
|
||||
}
|
||||
resolve({ stdout: this.netCoreSdkInstalledVersion });
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
}
|
||||
resolve({ stdout: this.netCoreSdkInstalledVersion });
|
||||
});
|
||||
child.on('error', (err) => {
|
||||
console.log(err);
|
||||
this.netCoreInstallState = netCoreInstallState.netCoreNotPresent;
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
@@ -170,7 +176,7 @@ export class NetCoreTool {
|
||||
return isSupported;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
this.netCoreInstallState = netCoreInstallState.netCoreVersionNotSupported;
|
||||
this.netCoreInstallState = netCoreInstallState.netCoreNotPresent;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -182,9 +188,9 @@ export class NetCoreTool {
|
||||
|
||||
if (!(await this.findOrInstallNetCore())) {
|
||||
if (this.netCoreInstallState === netCoreInstallState.netCoreNotPresent) {
|
||||
throw new Error(NetCoreInstallationConfirmation);
|
||||
throw new DotNetError(NetCoreInstallationConfirmation);
|
||||
} else {
|
||||
throw new Error(NetCoreSupportedVersionInstallationConfirmation(this.netCoreSdkInstalledVersion!));
|
||||
throw new DotNetError(NetCoreSupportedVersionInstallationConfirmation(this.netCoreSdkInstalledVersion!));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,3 +252,7 @@ export class NetCoreTool {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DotNetError extends Error {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user