|
14 | 14 | DotnetDebuggingMessage,
|
15 | 15 | DotnetExistingPathResolutionCompleted,
|
16 | 16 | DotnetInstallExpectedAbort,
|
| 17 | + DotnetNonZeroInstallerExitCodeError, |
17 | 18 | DotnetOfflineInstallUsed,
|
18 | 19 | DotnetOfflineWarning,
|
19 | 20 | DotnetUpgradedEvent,
|
|
22 | 23 | import { EventType } from './EventType';
|
23 | 24 | import { IEvent } from './IEvent';
|
24 | 25 | import { IEventStreamObserver } from './IEventStreamObserver';
|
| 26 | +import { WinMacGlobalInstaller } from '../Acquisition/WinMacGlobalInstaller'; |
25 | 27 |
|
26 | 28 | export class OutputChannelObserver implements IEventStreamObserver
|
27 | 29 | {
|
@@ -115,7 +117,37 @@ export class OutputChannelObserver implements IEventStreamObserver
|
115 | 117 | if (this.inProgressDownloads.includes(error?.install?.installId ?? ''))
|
116 | 118 | {
|
117 | 119 | this.outputChannel.appendLine(`Failed to download .NET ${error?.install?.installId}:`);
|
118 |
| - this.outputChannel.appendLine(error?.error?.message); |
| 120 | + |
| 121 | + // For user-friendly installer exit codes, show only the clean interpreted message |
| 122 | + if (error instanceof DotnetNonZeroInstallerExitCodeError) |
| 123 | + { |
| 124 | + const errorMessage = error?.error?.message || ''; |
| 125 | + const exitCodeMatch = errorMessage.match(/The exit code it gave us: (\w+)\./); |
| 126 | + if (exitCodeMatch && WinMacGlobalInstaller.IsUserFriendlyExitCode(exitCodeMatch[1])) |
| 127 | + { |
| 128 | + // Extract just the interpreted message (everything after the exit code line) |
| 129 | + const lines = errorMessage.split('\n'); |
| 130 | + if (lines.length > 1) |
| 131 | + { |
| 132 | + this.outputChannel.appendLine(lines.slice(1).join('\n')); |
| 133 | + } |
| 134 | + else |
| 135 | + { |
| 136 | + this.outputChannel.appendLine(errorMessage); |
| 137 | + } |
| 138 | + } |
| 139 | + else |
| 140 | + { |
| 141 | + // Show full error message for non-user-friendly codes |
| 142 | + this.outputChannel.appendLine(error?.error?.message); |
| 143 | + } |
| 144 | + } |
| 145 | + else |
| 146 | + { |
| 147 | + // Show full error message for non-installer errors |
| 148 | + this.outputChannel.appendLine(error?.error?.message); |
| 149 | + } |
| 150 | + |
119 | 151 | this.outputChannel.appendLine('');
|
120 | 152 |
|
121 | 153 | this.updateDownloadIndicators(error.install?.installId);
|
|
0 commit comments