вывод нормальной ошибки от сервера + фикс установки режима работы передатчика

This commit is contained in:
2025-01-16 13:50:01 +03:00
parent cbd2adc1c8
commit 790bfc06c2
7 changed files with 26 additions and 17 deletions

View File

@@ -281,7 +281,7 @@ public:
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
} catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/qos): Can't set QoS settings: " << e.what();
const std::string result = R"({"status":"error"})";
const std::string result = R"({"status": "error", "error": )" + api_driver::buildEscapedString(e.what()) + "}";
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
}
}));
@@ -309,7 +309,7 @@ public:
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
} catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/buclnb): Can't set BUC LNB settings: " << e.what();
const std::string result = R"({"status":"error"})";
const std::string result = R"({"status": "error", "error": )" + api_driver::buildEscapedString(e.what()) + "}";
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
}
}));
@@ -337,7 +337,7 @@ public:
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
} catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/cinc): Can't set CinC settings: " << e.what();
const std::string result = R"({"status":"error"})";
const std::string result = R"({"status": "error", "error": )" + api_driver::buildEscapedString(e.what()) + "}";
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
}
}));
@@ -365,7 +365,7 @@ public:
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
} catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/rxtx): Can't set RX/TX settings: " << e.what();
const std::string result = R"({"status":"error"})";
const std::string result = R"({"status": "error", "error": )" + api_driver::buildEscapedString(e.what()) + "}";
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
}
}));
@@ -393,7 +393,7 @@ public:
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
} catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/network): Can't set network settings: " << e.what();
const std::string result = R"({"status":"error"})";
const std::string result = R"({"status": "error", "error": )" + api_driver::buildEscapedString(e.what()) + "}";
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
}
}));