9 #include "nlohmann/json.hpp"
11 #include <fmt/format.h>
16 inline std::string generateJsonQuotedString(
const std::string&
string)
18 nlohmann::json V = string;
19 return V.dump(-1,
' ',
true, nlohmann::json::error_handler_t::hex);
22 enum class JsonErrorCodes : std::int32_t {
26 METHOD_NOT_ALLOWED = 405,
30 NOT_IMPLEMENTED = 501,
32 SERVICE_UNAVAILABLE = 503,
38 return fmt::format(
"{{\n \"error\":{{\n \"code\":{},\n \"message\":{}\n }}\n}}",
39 static_cast<std::int32_t
>(code),
40 generateJsonQuotedString(message));
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
std::string generateJsonErrorResponse(JsonErrorCodes code, const std::string &message)
Definition: JsonGeneration.hpp:36