Skip to content

Commit c41fd15

Browse files
Merge pull request actions#375 from akv-platform/fix-error-message
Make throwing errors in setup-dotnet more informative
2 parents 3cf27f1 + 0c86525 commit c41fd15

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: dist/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ class DotnetCoreInstaller {
398398
ignoreReturnCode: true,
399399
env: process.env
400400
};
401-
const { exitCode, stdout } = yield exec.getExecOutput(`"${scriptPath}"`, scriptArguments, getExecOutputOptions);
401+
const { exitCode, stderr } = yield exec.getExecOutput(`"${scriptPath}"`, scriptArguments, getExecOutputOptions);
402402
if (exitCode) {
403-
throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`);
403+
throw new Error(`Failed to install dotnet, exit code: ${exitCode}. ${stderr}`);
404404
}
405405
return this.outputDotnetVersion(dotnetVersion.value);
406406
});

Diff for: src/installer.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,15 @@ export class DotnetCoreInstaller {
236236
ignoreReturnCode: true,
237237
env: process.env as {string: string}
238238
};
239-
const {exitCode, stdout} = await exec.getExecOutput(
239+
const {exitCode, stderr} = await exec.getExecOutput(
240240
`"${scriptPath}"`,
241241
scriptArguments,
242242
getExecOutputOptions
243243
);
244244
if (exitCode) {
245-
throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`);
245+
throw new Error(
246+
`Failed to install dotnet, exit code: ${exitCode}. ${stderr}`
247+
);
246248
}
247249

248250
return this.outputDotnetVersion(dotnetVersion.value);

0 commit comments

Comments
 (0)