Skip to content

Commit 6510804

Browse files
committed
Feedback
1 parent 1329923 commit 6510804

File tree

5 files changed

+23
-27
lines changed

5 files changed

+23
-27
lines changed

src/observers/CsharpChannelObserver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { BaseChannelObserver } from "./BaseChannelObserver";
7-
import { BaseEvent, InstallationFailure, DebuggerNotInstalledFailure, DebuggerPrerequisiteFailure, ProjectJsonDeprecatedWarning, PackageInstallStart, CorruptedDownloadError } from "../omnisharp/loggingEvents";
7+
import { BaseEvent, InstallationFailure, DebuggerNotInstalledFailure, DebuggerPrerequisiteFailure, ProjectJsonDeprecatedWarning, PackageInstallStart, IntegrityCheckFailure } from "../omnisharp/loggingEvents";
88

99
export class CsharpChannelObserver extends BaseChannelObserver {
1010
public post = (event: BaseEvent) => {
1111
switch (event.constructor.name) {
1212
case PackageInstallStart.name:
13-
case CorruptedDownloadError.name:
13+
case IntegrityCheckFailure.name:
1414
this.showChannel(true);
1515
break;
1616
case InstallationFailure.name:

src/observers/CsharpLoggerObserver.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,19 @@ export class CsharpLoggerObserver extends BaseLoggerObserver {
5858
case Event.LatestBuildDownloadStart.name:
5959
this.logger.appendLine("Getting latest OmniSharp version information");
6060
break;
61-
case Event.DownloadRetry.name:
62-
this.handleDownloadRetry(<Event.DownloadRetry>event);
63-
break;
64-
case Event.CorruptedDownloadError.name:
65-
this.handleCorruptedDownloadError(<Event.CorruptedDownloadError>event);
61+
case Event.IntegrityCheckFailure.name:
62+
this.handleIntegrityCheckFailure(<Event.IntegrityCheckFailure>event);
6663
break;
6764
}
6865
}
6966

70-
private handleCorruptedDownloadError(event: Event.CorruptedDownloadError){
71-
this.logger.appendLine(`There was a problem downloading ${event.packageDescription}. Some functionalities may not work as expected. Please restart vscode to retrigger the download or download the package manually from ${event.url}`);
72-
}
73-
74-
private handleDownloadRetry(event: Event.DownloadRetry) {
75-
this.logger.appendLine(`Corrupt download obtained for package ${event.packageDescription}. Retrying..`);
67+
private handleIntegrityCheckFailure(event: Event.IntegrityCheckFailure) {
68+
if (event.retry) {
69+
this.logger.appendLine(`Package ${event.packageDescription} failed integrity check. Retrying..`);
70+
}
71+
else {
72+
this.logger.appendLine(`Package ${event.packageDescription} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download or download the package manually from ${event.url}`);
73+
}
7674
}
7775

7876
private handleDownloadSizeObtained(event: Event.DownloadSizeObtained) {

src/observers/ErrorMessageObserver.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { BaseEvent, ZipError, DotNetTestRunFailure, DotNetTestDebugStartFailure, CorruptedDownloadError } from "../omnisharp/loggingEvents";
6+
import { BaseEvent, ZipError, DotNetTestRunFailure, DotNetTestDebugStartFailure, IntegrityCheckFailure } from "../omnisharp/loggingEvents";
77
import { vscode } from "../vscodeAdapter";
88
import showErrorMessage from "./utils/ShowErrorMessage";
99

@@ -22,13 +22,15 @@ export class ErrorMessageObserver {
2222
case DotNetTestDebugStartFailure.name:
2323
this.handleDotNetTestDebugStartFailure(<DotNetTestDebugStartFailure>event);
2424
break;
25-
case CorruptedDownloadError.name:
26-
this.handleCorruptedDownloadError(<CorruptedDownloadError> event);
25+
case IntegrityCheckFailure.name:
26+
this.handleIntegrityCheckFailure(<IntegrityCheckFailure> event);
2727
}
2828
}
2929

30-
handleCorruptedDownloadError(event: CorruptedDownloadError): any {
31-
showErrorMessage(this.vscode, `There was a problem downloading ${event.packageDescription}. Some functionalities may not work as expected. Please restart vscode to retrigger the download or download the package manually from ${event.url}`);
30+
handleIntegrityCheckFailure(event: IntegrityCheckFailure) {
31+
if (!event.retry) {
32+
showErrorMessage(this.vscode, `Package ${event.packageDescription} failed integrity check. Some features may not work as expected. Please restart Visual Studio Code to retrigger the download or download the package manually from ${event.url}`);
33+
}
3234
}
3335

3436
private handleZipError(event: ZipError) {

src/omnisharp/loggingEvents.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,8 @@ export class OpenURL {
162162
constructor(public url: string) { }
163163
}
164164

165-
export class DownloadRetry {
166-
constructor(public packageDescription: string){ }
167-
}
168-
169-
export class CorruptedDownloadError {
170-
constructor(public packageDescription: string, public url: string){ }
165+
export class IntegrityCheckFailure {
166+
constructor(public packageDescription: string, public url: string, public retry: boolean){ }
171167
}
172168

173169
export class RazorPluginPathSpecified implements BaseEvent {

src/packageManager/downloadAndInstallPackages.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { EventStream } from '../EventStream';
1111
import { NetworkSettingsProvider } from "../NetworkSettings";
1212
import { AbsolutePathPackage } from "./AbsolutePathPackage";
1313
import { touchInstallFile, InstallFileType, deleteInstallFile, installFileExists } from "../common";
14-
import { InstallationFailure, DownloadRetry, CorruptedDownloadError } from "../omnisharp/loggingEvents";
14+
import { InstallationFailure, IntegrityCheckFailure } from "../omnisharp/loggingEvents";
1515
import { mkdirpSync } from "fs-extra";
1616
import { PackageInstallStart } from "../omnisharp/loggingEvents";
1717
import { isValidDownload } from './isValidInstallation';
@@ -36,10 +36,10 @@ export async function downloadAndInstallPackages(packages: AbsolutePathPackage[]
3636
}
3737
else {
3838
if (count == 1) {
39-
eventStream.post(new DownloadRetry(pkg.description));
39+
eventStream.post(new IntegrityCheckFailure(pkg.description, pkg.url, true));
4040
}
4141
else {
42-
eventStream.post(new CorruptedDownloadError(pkg.description, pkg.url));
42+
eventStream.post(new IntegrityCheckFailure(pkg.description, pkg.url, false));
4343
break;
4444
}
4545
}

0 commit comments

Comments
 (0)