Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message passing in Server::Start #1225

Merged
merged 1 commit into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ int main(int argc, char *argv[]) {
uint32_t ports[] = {config.port, config.tls_port, 0};
for (uint32_t *port = ports; *port; ++port) {
if (Util::IsPortInUse(*port)) {
LOG(ERROR) << "Could not create server TCP since the specified port[" << *port << "] is already in use"
<< std::endl;
LOG(ERROR) << "Could not create server TCP since the specified port[" << *port << "] is already in use";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does LOG already append endl?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

return 1;
}
}
Expand Down Expand Up @@ -351,6 +350,7 @@ int main(int argc, char *argv[]) {
srv = &server;
s = srv->Start();
if (!s.IsOK()) {
LOG(ERROR) << "Failed to start server: " << s.Msg();
return 1;
}
srv->Join();
Expand Down
6 changes: 2 additions & 4 deletions src/server/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ Status Server::Start() {
if (config_->cluster_enabled) {
auto s = cluster_->LoadClusterNodes(config_->NodesFilePath());
if (!s.IsOK()) {
LOG(ERROR) << "Failed to load cluster nodes info: " << s.Msg();
return Status(Status::NotOK, s.Msg());
return s.Prefixed("failed to load cluster nodes info");
}
// Create objects used for slot migration
slot_migrate_ =
Expand All @@ -149,8 +148,7 @@ Status Server::Start() {
// Create migrating thread
s = slot_migrate_->CreateMigrateHandleThread();
if (!s.IsOK()) {
LOG(ERROR) << "Failed to create migration thread, Err: " << s.Msg();
return Status(Status::NotOK);
return s.Prefixed("failed to create migration thread");
}
}

Expand Down