From 5cf15227e1cb41ba870786b833d27abbe5f9d966 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 31 Jan 2024 14:23:12 +0100 Subject: Actually thow exception if we can't parse the jobid when starting async job (#645) Return system error code on exception throw in zen command Clean up HttpClient::Response::ErrorMessage to remove redundant ": " --- src/zenhttp/httpclient.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/zenhttp/httpclient.cpp') diff --git a/src/zenhttp/httpclient.cpp b/src/zenhttp/httpclient.cpp index cc8a3f033..9811e5814 100644 --- a/src/zenhttp/httpclient.cpp +++ b/src/zenhttp/httpclient.cpp @@ -1089,11 +1089,16 @@ HttpClient::Response::ErrorMessage(std::string_view Prefix) const } else if (StatusCode != HttpResponseCode::ImATeapot && (int)StatusCode) { - return fmt::format("{}: HTTP error {} {} ({})", Prefix, (int)StatusCode, zen::ToString(StatusCode), ToText()); + return fmt::format("{}{}HTTP error {} {} ({})", + Prefix, + Prefix.empty() ? ""sv : ": "sv, + (int)StatusCode, + zen::ToString(StatusCode), + ToText()); } else { - return fmt::format("{}: {}", Prefix, "unknown error"); + return fmt::format("{}{}unknown error", Prefix, Prefix.empty() ? ""sv : ": "sv); } } -- cgit v1.2.3