Skip to content

Commit

Permalink
Fix error message passing in Server::Start (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored Jan 15, 2023
1 parent f1f7c10 commit c01a5c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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";
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

0 comments on commit c01a5c1

Please sign in to comment.