aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/httpclient.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-08-12 13:53:58 +0200
committerGitHub Enterprise <[email protected]>2025-08-12 13:53:58 +0200
commit3a9bc3071b9a9452a5aef23c438233fc9e86fb47 (patch)
treeb0a1d67fe765f2ddc96772db088d781be159d627 /src/zenhttp/httpclient.cpp
parentadd filtering to builds download (#463) (diff)
downloadzen-3a9bc3071b9a9452a5aef23c438233fc9e86fb47.tar.xz
zen-3a9bc3071b9a9452a5aef23c438233fc9e86fb47.zip
use new builds api for oplogs (#464)
- Improvement: Refactored jupiter oplog export code to reuse builds jupiter wrapper classes - Improvement: If `zen builds`, `zen oplog-import` or `zen oplog-import` command fails due to a http error, the return code for the program will be set to the error/status code
Diffstat (limited to 'src/zenhttp/httpclient.cpp')
-rw-r--r--src/zenhttp/httpclient.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/zenhttp/httpclient.cpp b/src/zenhttp/httpclient.cpp
index a2d323b5e..30a2bfc65 100644
--- a/src/zenhttp/httpclient.cpp
+++ b/src/zenhttp/httpclient.cpp
@@ -1628,12 +1628,13 @@ HttpClient::Response::ErrorMessage(std::string_view Prefix) const
}
else if (StatusCode != HttpResponseCode::ImATeapot && (int)StatusCode)
{
- return fmt::format("{}{}HTTP error {} {} ({})",
+ std::string TextResponse = ToText();
+ return fmt::format("{}{}HTTP error {} {}{}",
Prefix,
Prefix.empty() ? ""sv : ": "sv,
(int)StatusCode,
zen::ToString(StatusCode),
- ToText());
+ TextResponse.empty() ? ""sv : fmt::format(" ({})", TextResponse));
}
else
{
@@ -1646,7 +1647,7 @@ HttpClient::Response::ThrowError(std::string_view ErrorPrefix)
{
if (!IsSuccess())
{
- throw std::runtime_error(ErrorMessage(ErrorPrefix));
+ throw HttpClientError(ErrorMessage(ErrorPrefix), Error.has_value() ? Error.value().ErrorCode : 0, StatusCode);
}
}