summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-09-19 20:28:04 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-09-19 20:28:04 +0100
commitdf38ef1ec9af4f3f893323ed5c10e25fa481b1c6 (patch)
tree82c58a185c4d52560ece8493a3bd28b63262f7c1 /src
parent84bd17328a4dc027e689ca7b2a85744d6e2b7cf5 (diff)
downloadwebstat-df38ef1ec9af4f3f893323ed5c10e25fa481b1c6.tar.bz2
webstat-df38ef1ec9af4f3f893323ed5c10e25fa481b1c6.tar.xz
webstat-df38ef1ec9af4f3f893323ed5c10e25fa481b1c6.zip
Gracefully handle fatal exceptions and display message
Diffstat (limited to 'src')
-rw-r--r--src/webstat_logger_main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/webstat_logger_main.cpp b/src/webstat_logger_main.cpp
index 7817dc0..d30da80 100644
--- a/src/webstat_logger_main.cpp
+++ b/src/webstat_logger_main.cpp
@@ -57,6 +57,12 @@ main(int argc, char ** argv)
po::notify(optVars);
auto pool = std::make_shared<DB::ConnectionPool>(dbMax, dbKeep, std::move(dbType), std::move(dbConnStr));
- WebStat::Ingestor {getHostDetail(), pool}.ingestLog(stdin);
- return EXIT_SUCCESS;
+ try {
+ WebStat::Ingestor {getHostDetail(), pool}.ingestLog(stdin);
+ return EXIT_SUCCESS;
+ }
+ catch (const std::exception & excp) {
+ std::println(std::cerr, "Unhandled error: {}", excp.what());
+ return EXIT_FAILURE;
+ }
}