Skip to content

Commit

Permalink
Add some error log
Browse files Browse the repository at this point in the history
  • Loading branch information
ljcui committed Oct 29, 2024
1 parent d642423 commit 295baa4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/server/bolt_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,18 @@ std::function<void(bolt::BoltConnection &conn, bolt::BoltMsg msg,
return;
}
auto& val = std::any_cast<const std::unordered_map<std::string, std::any>&>(fields[0]);
if (!val.count("principal") || !val.count("credentials")
|| !val.count("user_agent")) {
LOG_ERROR() << "Hello msg fields error, "
"'principal' or 'credentials' or 'user_agent' are missing.";
bolt::PackStream ps;
ps.AppendFailure({{"code", "error"},
{"message", "Hello msg fields error, "
"'principal' or 'credentials' or 'user_agent' are missing."}});
conn.Respond(std::move(ps.MutableBuffer()));
conn.Close();
return;
}
auto& principal = std::any_cast<const std::string&>(val.at("principal"));
auto& credentials = std::any_cast<const std::string&>(val.at("credentials"));
auto galaxy = BoltServer::Instance().StateMachine()->GetGalaxy();
Expand Down

0 comments on commit 295baa4

Please sign in to comment.