Skip to content

Commit

Permalink
Merge pull request #129 from project-tsurugi/wip/i_674
Browse files Browse the repository at this point in the history
handle an error in altimeter initialization
  • Loading branch information
t-horikawa authored Mar 5, 2024
2 parents 0f1523e + f592e47 commit 61691f9
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/tateyama/server/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ int backend_main(int argc, char **argv) {
setup_glog(conf.get());
#ifdef ENABLE_ALTIMETER
auto altimeter_object = std::make_unique<tateyama::altimeter::altimeter_helper>(conf.get());
altimeter_object->start();
bool altimeter_wellness = true;
try {
altimeter_object->start();
} catch (std::exception &ex) {
altimeter_wellness = false;
LOG(WARNING) << "failed to initialize altimeter, cause is `" << ex.what() << "'";
}
#endif
try {
std::ostringstream oss;
Expand Down Expand Up @@ -170,6 +176,13 @@ int backend_main(int argc, char **argv) {
LOG(ERROR) << "Starting server failed due to errors in setting up server application framework.";
exit(1);
}
#ifdef ENABLE_ALTIMETER
if (!altimeter_wellness) {
tgsv.shutdown();
LOG(ERROR) << "Starting server failed due to an error in initializing altimeter logging subsystem.";
exit(1);
}
#endif

// should do after setup()
status_info->mutex_file(mutex_file.string());
Expand Down Expand Up @@ -250,7 +263,7 @@ int backend_main(int argc, char **argv) {
int main(int argc, char **argv) {
try {
return tateyama::server::backend_main(argc, argv);
} catch (std::exception &e) {
LOG(WARNING) << e.what();
} catch (std::exception &ex) {
LOG(WARNING) << ex.what();
}
}

0 comments on commit 61691f9

Please sign in to comment.