Move all code in `run()` function into try-blocks for consistent error handling
This commit is contained in:
parent
9113015294
commit
b3dd694a1c
|
@ -785,18 +785,19 @@ int ServiceSetup::run()
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef CPP_UTILITIES_DEBUG_BUILD
|
||||
try {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
printDatabases();
|
||||
|
||||
cout << Phrases::SuccessMessage << "Initializing SSL" << Phrases::End;
|
||||
webServer.initSsl();
|
||||
|
||||
{
|
||||
cout << Phrases::SuccessMessage << "Allocating worker thread pool (thread count: " << building.threadCount << ")" << Phrases::End;
|
||||
const auto buildWorker = building.allocateBuildWorker();
|
||||
|
||||
#ifndef CPP_UTILITIES_DEBUG_BUILD
|
||||
try {
|
||||
#endif
|
||||
cout << Phrases::SuccessMessage << "Starting web server (thread count: " << webServer.threadCount << "):" << TextAttribute::Reset
|
||||
<< " http://" << webServer.address << ':' << webServer.port << endl;
|
||||
WebAPI::Server::serve(*this);
|
||||
|
@ -813,8 +814,9 @@ int ServiceSetup::run()
|
|||
cerr << Phrases::ErrorMessage << "Server terminated due to an unknown error." << Phrases::EndFlush;
|
||||
return -4;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CPP_UTILITIES_DEBUG_BUILD
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue