use operator<< to convert ReqResult to string (#1126)

This commit is contained in:
Martin Chang 2021-12-13 12:37:31 +08:00 committed by GitHub
parent 6b677a3ff6
commit 080123ff96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -341,17 +341,10 @@ inline void internal::HttpRespAwaiter::await_suspend(
setValue(resp);
else
{
std::string reason;
if (result == ReqResult::BadResponse)
reason = "BadResponse";
else if (result == ReqResult::NetworkFailure)
reason = "NetworkFailure";
else if (result == ReqResult::BadServerAddress)
reason = "BadServerAddress";
else if (result == ReqResult::Timeout)
reason = "Timeout";
std::stringstream ss;
ss << result;
setException(
std::make_exception_ptr(std::runtime_error(reason)));
std::make_exception_ptr(std::runtime_error(ss.str())));
}
handle.resume();
},