add try/catch to PostHTTP

This commit is contained in:
Lion Kortlepel
2021-02-01 23:13:58 +01:00
parent 5f3fecb92c
commit d5541ae154
+3 -3
View File
@@ -71,7 +71,7 @@ std::string HttpRequest(const std::string& host, int port, const std::string& ta
} }
std::string PostHTTP(const std::string& host, const std::string& target, const std::unordered_map<std::string, std::string>& fields, const std::string& body, bool json) { std::string PostHTTP(const std::string& host, const std::string& target, const std::unordered_map<std::string, std::string>& fields, const std::string& body, bool json) {
//try { try {
net::io_context io; net::io_context io;
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
@@ -154,8 +154,8 @@ std::string PostHTTP(const std::string& host, const std::string& target, const s
debug("POST " + host + target + ": " + debug_response_str); debug("POST " + host + target + ": " + debug_response_str);
return std::string(response.body()); return std::string(response.body());
/*} catch (const std::exception& e) { } catch (const std::exception& e) {
error(e.what()); error(e.what());
return "-1"; return "-1";
}*/ }
} }