Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display ReturnResponseUrl if present #2210

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(PurgeInstallDirectory);
WINGET_DEFINE_RESOURCE_STRINGID(QueryArgumentDescription);
WINGET_DEFINE_RESOURCE_STRINGID(RainbowArgumentDescription);
WINGET_DEFINE_RESOURCE_STRINGID(RelatedLink);
WINGET_DEFINE_RESOURCE_STRINGID(RenameArgumentDescription);
WINGET_DEFINE_RESOURCE_STRINGID(ReparsePointsNotSupportedError);
WINGET_DEFINE_RESOURCE_STRINGID(ReportIdentityFound);
Expand Down
9 changes: 8 additions & 1 deletion src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using namespace AppInstaller::Manifest;
using namespace AppInstaller::Repository;
using namespace AppInstaller::Settings;
using namespace AppInstaller::Utility;

using namespace AppInstaller::Utility::literals;

namespace AppInstaller::CLI::Workflow
{
Expand Down Expand Up @@ -377,6 +377,13 @@ namespace AppInstaller::CLI::Workflow
{
auto returnCode = ExpectedReturnCode::GetExpectedReturnCode(expectedReturnCodeItr->second.ReturnResponseEnum);
context.Reporter.Error() << returnCode.Message << std::endl;

auto returnResponseUrl = expectedReturnCodeItr->second.ReturnResponseUrl;
if (!returnResponseUrl.empty())
{
context.Reporter.Error() << Resource::String::RelatedLink << ": "_liv << returnResponseUrl << std::endl;
}

AICLI_TERMINATE_CONTEXT(returnCode.HResult);
}

Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1337,4 +1337,7 @@ Please specify one of them using the `--source` option to proceed.</value>
<data name="UnableToPurgeInstallDirectory" xml:space="preserve">
<value>Cannot purge install directory, as it was not created by WinGet</value>
</data>
<data name="RelatedLink" xml:space="preserve">
<value>Related Link</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Installers:
ReturnResponse: noNetwork
- InstallerReturnCode: 8
ReturnResponse: contactSupport
ReturnResponseUrl: https://TestReturnResponseUrl
- InstallerReturnCode: 9
ReturnResponse: rebootRequiredToFinish
- InstallerReturnCode: 10
Expand All @@ -43,4 +44,4 @@ Installers:
- InstallerReturnCode: 15
ReturnResponse: blockedByPolicy
ManifestType: singleton
ManifestVersion: 1.1.0
ManifestVersion: 1.2.0
1 change: 1 addition & 0 deletions src/AppInstallerCLITests/WorkFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ TEST_CASE("InstallFlow_ExpectedReturnCodes", "[InstallFlow][workflow]")
REQUIRE_TERMINATED_WITH(context, APPINSTALLER_CLI_ERROR_INSTALL_CONTACT_SUPPORT);
REQUIRE(std::filesystem::exists(installResultPath.GetPath()));
REQUIRE(installOutput.str().find(Resource::LocString(Resource::String::InstallFlowReturnCodeContactSupport).get()) != std::string::npos);
REQUIRE(installOutput.str().find("https://TestReturnResponseUrl") != std::string::npos);
}

TEST_CASE("InstallFlowWithNonApplicableArchitecture", "[InstallFlow][workflow]")
Expand Down