aboutsummaryrefslogtreecommitdiff
path: root/src/zen/cmds/builds_cmd.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-09-05 13:02:27 +0200
committerGitHub Enterprise <[email protected]>2025-09-05 13:02:27 +0200
commit45b0307d42b22e04cee63467a8fdb898a2d8d552 (patch)
tree905b3eb62af89269be5b15f4c407d900ce86f7f3 /src/zen/cmds/builds_cmd.cpp
parentAvoid mutating executable paths when copying files during full service instal... (diff)
downloadarchived-zen-45b0307d42b22e04cee63467a8fdb898a2d8d552.tar.xz
archived-zen-45b0307d42b22e04cee63467a8fdb898a2d8d552.zip
refactor zen command return value handling (#487)
- Improvement: Use consistent language for command line argument parsing errors - Improvement: Changed zen command parsing errors to output help first and error last to make it easier to spot the error - Improvement: Refactor zen command return codes to conform to valid Linux range (0-255) kSuccess = 0, kOtherError = 1, kBadInput = 2, kOutOfMemory = 16, kOutOfDisk = 17, kAssertError = 70, kHttpOtherClientError = 80, kHttpCantConnectError = 81, kHttpNotFound = 66, // NotFound(404) kHttpUnauthorized = 77, // Unauthorized(401), kHttpSLLError = 82, kHttpForbidden = 83, // Forbidden(403) kHttpTimeout = 84, // RequestTimeout(408) kHttpConflict = 85, // Conflict(409) kHttpNoHost = 86, kHttpOtherServerError = 90, kHttpInternalServerError = 91, // InternalServerError(500) kHttpServiceUnavailable = 69, // ServiceUnavailable(503) kHttpBadGateway = 92, // BadGateway(502) kHttpGatewayTimeout = 93, // GatewayTimeout(504)
Diffstat (limited to 'src/zen/cmds/builds_cmd.cpp')
-rw-r--r--src/zen/cmds/builds_cmd.cpp167
1 files changed, 90 insertions, 77 deletions
diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp
index 2c6b8e50e..d858fa328 100644
--- a/src/zen/cmds/builds_cmd.cpp
+++ b/src/zen/cmds/builds_cmd.cpp
@@ -10472,7 +10472,7 @@ BuildsCommand::BuildsCommand()
BuildsCommand::~BuildsCommand() = default;
-int
+void
BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
ZEN_UNUSED(GlobalOptions);
@@ -10489,17 +10489,17 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
int ParentCommandArgCount = GetSubCommand(m_Options, argc, argv, m_SubCommands, SubOption, SubCommandArguments);
if (!ParseOptions(ParentCommandArgCount, argv))
{
- return 0;
+ return;
}
if (SubOption == nullptr)
{
- throw zen::OptionParseException("command verb is missing");
+ throw OptionParseException("'verb' option is required", m_Options.help());
}
if (!ParseOptions(*SubOption, gsl::narrow<int>(SubCommandArguments.size()), SubCommandArguments.data()))
{
- return 0;
+ return;
}
std::filesystem::path SystemRootDir;
@@ -10522,19 +10522,22 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (!m_Host.empty())
{
- throw zen::OptionParseException(fmt::format("host is not compatible with the url option\n{}", SubOption->help()));
+ throw OptionParseException(fmt::format("'--host' ('{}') conflicts with '--url' ('{}')", m_Host, m_Url), SubOption->help());
}
if (!m_Bucket.empty())
{
- throw zen::OptionParseException(fmt::format("bucket is not compatible with the url option\n{}", SubOption->help()));
+ throw OptionParseException(fmt::format("'--bucket' ('{}') conflicts with '--url' ('{}')", m_Bucket, m_Url),
+ SubOption->help());
}
if (!m_BuildId.empty())
{
- throw zen::OptionParseException(fmt::format("buildid is not compatible with the url option\n{}", SubOption->help()));
+ throw OptionParseException(fmt::format("'--buildid' ('{}') conflicts with '--url' ('{}')", m_BuildId, m_Url),
+ SubOption->help());
}
if (!ParseCloudUrl(m_Url, m_Host, m_Namespace, m_Bucket, m_BuildId))
{
- throw zen::OptionParseException(fmt::format("url does not match the Cloud Artifact URL format\n{}", SubOption->help()));
+ throw OptionParseException("'--url' ('{}') is malformed, it does not match the Cloud Artifact URL format",
+ SubOption->help());
}
}
@@ -10542,21 +10545,22 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (!m_StoragePath.empty())
{
- throw zen::OptionParseException(
- fmt::format("host/url/override-host is not compatible with the storage-path option\n{}", SubOption->help()));
+ throw OptionParseException(
+ fmt::format("'--storage-path' ('{}') conflicts with '--host'/'--url'/'--override-host' options", m_StoragePath),
+ SubOption->help());
}
if (RequireNamespace && m_Namespace.empty())
{
- throw zen::OptionParseException(fmt::format("namespace option is required for this storage option\n{}", SubOption->help()));
+ throw OptionParseException("'--namespace' is required", SubOption->help());
}
if (RequireBucket && m_Bucket.empty())
{
- throw zen::OptionParseException(fmt::format("bucket option is required for this storage option\n{}", SubOption->help()));
+ throw OptionParseException("'--bucket' is required", SubOption->help());
}
}
else if (m_StoragePath.empty())
{
- throw zen::OptionParseException(fmt::format("At least one storage option is required\n{}", SubOption->help()));
+ throw OptionParseException("'--host', '--url', '--override-host' or '--storage-path' is required", SubOption->help());
}
MakeSafeAbsolutePathÍnPlace(m_StoragePath);
};
@@ -10594,11 +10598,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
.EncryptionIV = AesIV128Bit::FromString(m_EncryptionIV)};
if (!AuthMgrConfig.EncryptionKey.IsValid())
{
- throw zen::OptionParseException("Invalid AES encryption key");
+ throw OptionParseException(fmt::format("'--encryption-aes-key' ('{}') is malformed", m_EncryptionKey), SubOption->help());
}
if (!AuthMgrConfig.EncryptionIV.IsValid())
{
- throw zen::OptionParseException("Invalid AES initialization vector");
+ throw OptionParseException(fmt::format("'--encryption-aes-iv' ('{}') is malformed", m_EncryptionIV), SubOption->help());
}
Auth = AuthMgr::Create(AuthMgrConfig);
}
@@ -10701,7 +10705,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
auto ParseOutputOptions = [&]() {
if (m_Verbose && m_Quiet)
{
- throw std::runtime_error("--verbose option is not compatible with --quiet option");
+ throw OptionParseException("'--verbose' conflicts with '--quiet'", SubOption->help());
}
IsVerbose = m_Verbose;
IsQuiet = m_Quiet;
@@ -10709,7 +10713,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (IsQuiet)
{
- throw std::runtime_error("--quiet option is not compatible with --log-progress option");
+ throw OptionParseException("'--quiet' conflicts with '--log-progress'", SubOption->help());
}
ProgressMode = ProgressBar::Mode::Log;
}
@@ -10717,7 +10721,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (IsQuiet)
{
- throw std::runtime_error("--quiet option is not compatible with --plain-progress option");
+ throw OptionParseException("'--quiet' conflicts with '--plain-progress'", SubOption->help());
}
ProgressMode = ProgressBar::Mode::Plain;
}
@@ -10952,7 +10956,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
else
{
- throw zen::OptionParseException(fmt::format("Storage option is missing\n{}", SubOption->help()));
+ throw OptionParseException("'--host', '--url', '--override-host' or '--storage-path' is required", SubOption->help());
}
if (!m_ZenCacheHost.empty())
{
@@ -10998,7 +11002,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
auto ParsePath = [&]() {
if (m_Path.empty())
{
- throw zen::OptionParseException(fmt::format("local-path is required\n{}", SubOption->help()));
+ throw OptionParseException("'--local-path' is required", SubOption->help());
}
MakeSafeAbsolutePathÍnPlace(m_Path);
};
@@ -11024,7 +11028,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
auto ParseDiffPath = [&]() {
if (m_DiffPath.empty())
{
- throw zen::OptionParseException(fmt::format("compare-path is required\n{}", SubOption->help()));
+ throw OptionParseException("'--compare-path' is required", SubOption->help());
}
MakeSafeAbsolutePathÍnPlace(m_DiffPath);
};
@@ -11033,13 +11037,20 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
m_BlobHash = RemoveQuotes(m_BlobHash);
if (m_BlobHash.empty())
{
- throw zen::OptionParseException(fmt::format("Blob hash string is missing\n{}", SubOption->help()));
+ throw OptionParseException("'--blob-hash' is required", SubOption->help());
+ }
+
+ if (m_BlobHash.length() != IoHash::StringLength)
+ {
+ throw OptionParseException(
+ fmt::format("'--blob-hash' ('{}') is malfomed, it must be {} characters long", m_BlobHash, IoHash::StringLength),
+ SubOption->help());
}
IoHash BlobHash;
if (!IoHash::TryParse(m_BlobHash, BlobHash))
{
- throw zen::OptionParseException(fmt::format("Blob hash string is invalid\n{}", SubOption->help()));
+ throw OptionParseException(fmt::format("'--blob-hash' ('{}') is malformed", m_BlobHash), SubOption->help());
}
return BlobHash;
@@ -11049,11 +11060,13 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
m_BuildId = RemoveQuotes(m_BuildId);
if (m_BuildId.length() != Oid::StringLength)
{
- throw zen::OptionParseException(fmt::format("Invalid build id\n{}", SubOption->help()));
+ throw OptionParseException(
+ fmt::format("'--build-id' ('{}') is malfomed, it must be {} characters long", m_BuildId, Oid::StringLength),
+ SubOption->help());
}
else if (Oid BuildId = Oid::FromHexString(m_BuildId); BuildId == Oid::Zero)
{
- throw zen::OptionParseException(fmt::format("Invalid build id\n{}", SubOption->help()));
+ throw OptionParseException(fmt::format("'--build-id' ('{}') is invalid", m_BuildId), SubOption->help());
}
else
{
@@ -11065,11 +11078,13 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
m_BuildPartId = RemoveQuotes(m_BuildPartId);
if (m_BuildPartId.length() != Oid::StringLength)
{
- throw zen::OptionParseException(fmt::format("Invalid build part id\n{}", SubOption->help()));
+ throw OptionParseException(
+ fmt::format("'--build-id' ('{}') is malformed, it must be {} characters long", m_BuildPartId, Oid::StringLength),
+ SubOption->help());
}
else if (Oid BuildPartId = Oid::FromHexString(m_BuildPartId); BuildPartId == Oid::Zero)
{
- throw zen::OptionParseException(fmt::format("Invalid build part id\n{}", SubOption->help()));
+ throw OptionParseException(fmt::format("'--build-id' ('{}') is malformed", m_BuildPartId), SubOption->help());
}
else
{
@@ -11084,7 +11099,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
BuildPartIds.push_back(Oid::TryFromHexString(RemoveQuotes(BuildPartId)));
if (BuildPartIds.back() == Oid::Zero)
{
- throw zen::OptionParseException(fmt::format("build-part-id '{}' is invalid\n{}", BuildPartId, SubOption->help()));
+ throw OptionParseException(fmt::format("'--build-part-id' ('{}') is malformed", BuildPartId), SubOption->help());
}
}
return BuildPartIds;
@@ -11097,7 +11112,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
BuildPartNames.push_back(std::string(RemoveQuotes(BuildPartName)));
if (BuildPartNames.back().empty())
{
- throw zen::OptionParseException(fmt::format("build-part-names '{}' is invalid\n{}", BuildPartName, SubOption->help()));
+ throw OptionParseException(fmt::format("'--build-part-names' ('{}') is invalid", BuildPartName), SubOption->help());
}
}
return BuildPartNames;
@@ -11108,11 +11123,13 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (m_BuildMetadataPath.empty() && m_BuildMetadata.empty())
{
- throw zen::OptionParseException(fmt::format("Options for builds target are missing\n{}", SubOption->help()));
+ throw OptionParseException("'--metadata-path' or '--metadata' is required", SubOption->help());
}
if (!m_BuildMetadataPath.empty() && !m_BuildMetadata.empty())
{
- throw zen::OptionParseException(fmt::format("Conflicting options for builds target\n{}", SubOption->help()));
+ throw OptionParseException(
+ fmt::format("'--metadata-path' ('{}') conflicts with '--metadata' ('{}')", m_BuildMetadataPath, m_BuildMetadata),
+ SubOption->help());
}
if (!m_BuildMetadataPath.empty())
@@ -11149,12 +11166,11 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
if (!m_BuildMetadataPath.empty())
{
- throw zen::OptionParseException(
- fmt::format("metadata-path option is only valid if creating a build\n{}", SubOption->help()));
+ throw OptionParseException("'--metadata-path' requires '--create-build'", SubOption->help());
}
if (!m_BuildMetadata.empty())
{
- throw zen::OptionParseException(fmt::format("metadata option is only valid if creating a build\n{}", SubOption->help()));
+ throw OptionParseException("'--metadata' requires '--create-build'", SubOption->help());
}
}
return {};
@@ -11220,8 +11236,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
WriteFile(ListResultPath, IoBuffer(IoBuffer::Wrap, SB.Data(), SB.Size()));
}
}
-
- return 0;
+ return;
}
if (SubOption == &m_ListOptions)
@@ -11313,8 +11328,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
WriteFile(m_ListResultPath, IoBuffer(IoBuffer::Wrap, SB.Data(), SB.Size()));
}
}
-
- return 0;
+ return;
}
if (SubOption == &m_UploadOptions)
@@ -11412,7 +11426,10 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
: 0);
}
}
- return AbortFlag ? 11 : 0;
+ if (AbortFlag)
+ {
+ throw std::runtime_error("Upload aborted");
+ }
}
if (SubOption == &m_DownloadOptions)
@@ -11446,8 +11463,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (m_PostDownloadVerify && m_PrimeCacheOnly)
{
- throw zen::OptionParseException(
- fmt::format("'cache-prime-only' option is not compatible with 'verify' option\n{}", SubOption->help()));
+ throw OptionParseException("'--cache-prime-only' conflicts with '--verify'", SubOption->help());
}
if (m_Clean && m_PrimeCacheOnly)
@@ -11480,7 +11496,10 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
m_IncludeWildcard,
m_ExcludeWildcard);
- return AbortFlag ? 11 : 0;
+ if (AbortFlag)
+ {
+ throw std::runtime_error("Download aborted");
+ }
}
if (SubOption == &m_LsOptions)
@@ -11516,7 +11535,10 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
ListBuild(Storage, BuildId, BuildPartIds, BuildPartNames, m_IncludeWildcard, m_ExcludeWildcard);
- return AbortFlag ? 11 : 0;
+ if (AbortFlag)
+ {
+ throw std::runtime_error("List build aborted");
+ }
}
if (SubOption == &m_DiffOptions)
@@ -11525,7 +11547,10 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
ParseDiffPath();
DiffFolders(m_Path, m_DiffPath, m_OnlyChunked);
- return AbortFlag ? 11 : 0;
+ if (AbortFlag)
+ {
+ throw std::runtime_error("Diff folders aborted");
+ }
}
if (SubOption == &m_FetchBlobOptions)
@@ -11568,7 +11593,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
ValidateBlob(*Storage.BuildStorage, BuildId, BlobHash, CompressedSize, DecompressedSize);
if (AbortFlag)
{
- return 11;
+ throw std::runtime_error("Fetch blob aborted");
}
if (!IsQuiet)
{
@@ -11577,7 +11602,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
CompressedSize,
DecompressedSize);
}
- return 0;
+ return;
}
if (SubOption == &m_ValidateBuildPartOptions)
@@ -11617,7 +11642,9 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (!m_BuildPartName.empty() && !m_BuildPartId.empty())
{
- throw zen::OptionParseException(fmt::format("build-part-id conflicts with build-part-name\n{}", SubOption->help()));
+ throw OptionParseException(
+ fmt::format("'--build-part-id' ('{}') conflicts with '--build-part-name' ('{}')", m_BuildPartId, m_BuildPartName),
+ SubOption->help());
}
const Oid BuildPartId = m_BuildPartName.empty() ? Oid::Zero : ParseBuildPartId();
@@ -11626,7 +11653,10 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
DownloadStatistics DownloadStats;
ValidateBuildPart(*Storage.BuildStorage, BuildId, BuildPartId, m_BuildPartName, ValidateStats, DownloadStats);
- return AbortFlag ? 13 : 0;
+ if (AbortFlag)
+ {
+ throw std::runtime_error("Validate build part failed");
+ }
}
if (SubOption == &m_MultiTestDownloadOptions)
@@ -11659,7 +11689,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
Oid BuildId = Oid::FromHexString(RemoveQuotes(BuildIdString));
if (BuildId == Oid::Zero)
{
- throw zen::OptionParseException(fmt::format("invalid build id {}\n{}", BuildIdString, SubOption->help()));
+ throw OptionParseException(fmt::format("'--build-id' ('{}') is malformed", BuildIdString), SubOption->help());
}
DownloadFolder(Storage,
BuildId,
@@ -11678,8 +11708,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
""sv);
if (AbortFlag)
{
- ZEN_CONSOLE("Download cancelled");
- return 11;
+ throw std::runtime_error("Multitest aborted");
}
if (!IsQuiet)
{
@@ -11690,7 +11719,6 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
ZEN_CONSOLE("Completed in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
- return 0;
}
auto ParseZenProcessId = [&]() {
@@ -11706,7 +11734,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
if (!RunningProcess.IsValid())
{
- throw zen::OptionParseException(
+ throw std::runtime_error(
fmt::format("Unable to find a running instance of the zen executable '{}'", RunningExecutablePath));
}
m_ZenProcessId = RunningProcess.Pid();
@@ -11718,7 +11746,6 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
ParseZenProcessId();
ZenState RunningState(m_ZenProcessId);
RunningState.StateData().Pause.store(true);
- return 0;
}
if (SubOption == &m_ResumeOptions)
@@ -11726,7 +11753,6 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
ParseZenProcessId();
ZenState RunningState(m_ZenProcessId);
RunningState.StateData().Pause.store(false);
- return 0;
}
if (SubOption == &m_AbortOptions)
@@ -11734,7 +11760,6 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
ParseZenProcessId();
ZenState RunningState(m_ZenProcessId);
RunningState.StateData().Abort.store(true);
- return 0;
}
if (SubOption == &m_TestOptions)
@@ -11834,8 +11859,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
true);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Upload failed.");
- return 11;
+ throw std::runtime_error("Test aborted. (Upload build)");
}
ZEN_CONSOLE("\nDownload Build {}, Part {} ({}) to '{}'", BuildId, BuildPartId, m_BuildPartName, DownloadPath);
@@ -11856,8 +11880,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
""sv);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Download failed.");
- return 11;
+ throw std::runtime_error("Test aborted. (Download build)");
}
ZEN_CONSOLE("\nRe-download Build {}, Part {} ({}) to '{}' (identical target)", BuildId, BuildPartId, m_BuildPartName, DownloadPath);
@@ -11878,8 +11901,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
""sv);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Re-download failed. (identical target)");
- return 11;
+ throw std::runtime_error("Test aborted. (Re-download identical target)");
}
auto ScrambleDir = [](const std::filesystem::path& Path) {
@@ -11992,8 +12014,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
""sv);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Re-download failed. (scrambled target)");
- return 11;
+ throw std::runtime_error("Test aborted. (Re-download scrambled target)");
}
ScrambleDir(DownloadPath);
@@ -12024,8 +12045,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
true);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Upload of scrambled failed.");
- return 11;
+ throw std::runtime_error("Test aborted. (Upload scrambled)");
}
ZEN_CONSOLE("\nDownload Build {}, Part {} ({}) to '{}' (original)", BuildId, BuildPartId, m_BuildPartName, DownloadPath);
@@ -12046,8 +12066,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
""sv);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Re-download failed.");
- return 11;
+ throw std::runtime_error("Test aborted. (Download original)");
}
ZEN_CONSOLE("\nDownload Build {}, Part {} ({}) to '{}' (scrambled)", BuildId2, BuildPartId2, m_BuildPartName, DownloadPath);
@@ -12068,8 +12087,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
""sv);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Re-download failed.");
- return 11;
+ throw std::runtime_error("Test aborted. (Download scrambled)");
}
ZEN_CONSOLE("\nRe-download Build {}, Part {} ({}) to '{}' (scrambled)", BuildId2, BuildPartId2, m_BuildPartName, DownloadPath);
@@ -12090,8 +12108,7 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
""sv);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Re-download failed.");
- return 11;
+ throw std::runtime_error("Test aborted. (Re-download scrambled)");
}
ZEN_CONSOLE("\nDownload Build {}, Part {} ({}) to '{}' (original)", BuildId, BuildPartId, m_BuildPartName, DownloadPath2);
@@ -12112,13 +12129,9 @@ BuildsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
""sv);
if (AbortFlag)
{
- ZEN_CONSOLE_ERROR("Re-download failed.");
- return 11;
+ throw std::runtime_error("Test aborted. (Download original)");
}
-
- return 0;
}
- ZEN_ASSERT(false);
}
} // namespace zen