Обновление cpp-сервера

This commit is contained in:
2024-02-21 11:45:29 +03:00
parent 3f65dd50d3
commit 4043250ca5
50 changed files with 597 additions and 358 deletions
+14
View File
@@ -0,0 +1,14 @@
#include <sstream>
#include <utils/utils.h>
namespace utils {
void CheckForRequiredFields(const json& json, std::initializer_list<std::string_view> fields) {
for (const auto& field : fields)
if (!json.contains(field)) {
std::ostringstream message;
message << "request doesn't contain required field '" << field << "'";
throw std::runtime_error(message.str());
}
}
}