From 6040f37a7edb2f25cefd26ca4eaefc0a79f6371c Mon Sep 17 00:00:00 2001 From: John Colvin Date: Mon, 3 Oct 2022 16:00:22 -0400 Subject: [PATCH] diag: Log emumba cfg parse error code --- src/server/sparkd/cmds/crypto/DeribitDemoConfiguration.cpp | 5 +++-- src/server/sparkd/md/platforms/emumba/EmumbaMain.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/server/sparkd/cmds/crypto/DeribitDemoConfiguration.cpp b/src/server/sparkd/cmds/crypto/DeribitDemoConfiguration.cpp index ee5e077f3..7930b60d1 100644 --- a/src/server/sparkd/cmds/crypto/DeribitDemoConfiguration.cpp +++ b/src/server/sparkd/cmds/crypto/DeribitDemoConfiguration.cpp @@ -141,8 +141,9 @@ std::optional DeribitDemoConfiguration::read_file( rapidjson::IStreamWrapper isw{configFile}; rapidjson::Document doc{}; - if (doc.ParseStream(isw).HasParseError()) { - LOG(md, Error, "Error in parsing config from {}", config_path); + auto &res = doc.ParseStream(isw); + if (res.HasParseError()) { + LOG(md, Error, "Error in parsing config from {}: {}", config_path, res.GetParseError()); return std::nullopt; } diff --git a/src/server/sparkd/md/platforms/emumba/EmumbaMain.cpp b/src/server/sparkd/md/platforms/emumba/EmumbaMain.cpp index 7e7895569..18c5cf5c7 100644 --- a/src/server/sparkd/md/platforms/emumba/EmumbaMain.cpp +++ b/src/server/sparkd/md/platforms/emumba/EmumbaMain.cpp @@ -21,6 +21,7 @@ #include #include +#include #include using namespace std; @@ -47,8 +48,8 @@ struct EmumbaMain::PImpl { listener(sec_index, producer) { auto config_path = os::sparkdata_path("conf") + "deribit_demo_config.json"; - std::optional conf = - bts::cmds::DeribitDemoConfiguration::read_file(config_path); + auto conf = bts::cmds::DeribitDemoConfiguration::read_file(config_path); + bts_assert_msg(conf.has_value(), "Failed to parse deribit config"); // log for (const auto &s : conf.value().symbol_config_list) { LOG(md, Info, "sub.symbol: {}", s.symbol_name);