mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Improve error logging
This commit is contained in:
parent
03bb1fd089
commit
cbd459b0a5
|
|
@ -20,6 +20,12 @@ RequestResult SendGetRequest(const std::string &uri, const std::string &path,
|
|||
httplib::Client cli(uri);
|
||||
auto headers = getTokenRequestHeaders(token);
|
||||
auto response = cli.Get(path, params, headers);
|
||||
if (!response) {
|
||||
auto err = response.error();
|
||||
blog(LOG_INFO, "%s failed - %s", __func__,
|
||||
httplib::to_string(err).c_str());
|
||||
return {};
|
||||
}
|
||||
RequestResult result;
|
||||
result.status = response->status;
|
||||
if (response->body.empty()) {
|
||||
|
|
@ -39,6 +45,12 @@ RequestResult SendPostRequest(const std::string &uri, const std::string &path,
|
|||
auto json = obs_data_get_json(data);
|
||||
std::string body = json ? json : "";
|
||||
auto response = cli.Post(path, headers, body, "application/json");
|
||||
if (!response) {
|
||||
auto err = response.error();
|
||||
blog(LOG_INFO, "%s failed - %s", __func__,
|
||||
httplib::to_string(err).c_str());
|
||||
return {};
|
||||
}
|
||||
RequestResult result;
|
||||
result.status = response->status;
|
||||
if (response->body.empty()) {
|
||||
|
|
@ -58,6 +70,12 @@ RequestResult SendPatchRequest(const std::string &uri, const std::string &path,
|
|||
auto json = obs_data_get_json(data);
|
||||
std::string body = json ? json : "";
|
||||
auto response = cli.Patch(path, headers, body, "application/json");
|
||||
if (!response) {
|
||||
auto err = response.error();
|
||||
blog(LOG_INFO, "%s failed - %s", __func__,
|
||||
httplib::to_string(err).c_str());
|
||||
return {};
|
||||
}
|
||||
RequestResult result;
|
||||
result.status = response->status;
|
||||
if (response->body.empty()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user