Merge pull request #375 from akv-platform/fix-error-message

Make throwing errors in setup-dotnet more informative
This commit is contained in:
Marko Zivic 2023-01-30 14:21:47 +01:00 committed by GitHub
commit c41fd15071
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

4
dist/index.js vendored
View File

@ -398,9 +398,9 @@ class DotnetCoreInstaller {
ignoreReturnCode: true,
env: process.env
};
const { exitCode, stdout } = yield exec.getExecOutput(`"${scriptPath}"`, scriptArguments, getExecOutputOptions);
const { exitCode, stderr } = yield exec.getExecOutput(`"${scriptPath}"`, scriptArguments, getExecOutputOptions);
if (exitCode) {
throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`);
throw new Error(`Failed to install dotnet, exit code: ${exitCode}. ${stderr}`);
}
return this.outputDotnetVersion(dotnetVersion.value);
});

View File

@ -236,13 +236,15 @@ export class DotnetCoreInstaller {
ignoreReturnCode: true,
env: process.env as {string: string}
};
const {exitCode, stdout} = await exec.getExecOutput(
const {exitCode, stderr} = await exec.getExecOutput(
`"${scriptPath}"`,
scriptArguments,
getExecOutputOptions
);
if (exitCode) {
throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`);
throw new Error(
`Failed to install dotnet, exit code: ${exitCode}. ${stderr}`
);
}
return this.outputDotnetVersion(dotnetVersion.value);