Skip to content

Commit

Permalink
add support for returnresponseurl (#2210)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryfu-msft authored Jun 1, 2022
1 parent 3f4645a commit c1a122e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
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

0 comments on commit c1a122e

Please sign in to comment.