Address some fo the feedback

This commit is contained in:
Aaron Kimbre
2025-01-02 20:09:44 -06:00
parent 2b325165aa
commit 181bb0ce14
3 changed files with 13 additions and 19 deletions

View File

@@ -133,3 +133,12 @@ void ChatWebAPI::Listen() {
void ChatWebAPI::ReceiveRequests() {
mg_mgr_poll(&mgr, 15);
}
std::optional<json> ChatWebAPI::ParseJSON(char* data) {
try {
return std::make_optional<json>(json::parse(data));
} catch (const std::exception& e) {
LOG_DEBUG("Failed to parse JSON: %s", e.what());
return std::nullopt;
}
}