From: arjen Date: Mon, 27 Oct 2003 13:00:15 +0000 (+0000) Subject: Catch exceptions from the database library X-Git-Tag: V0_0_9~22 X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=commitdiff_plain;h=4795b22da9ab5ed4cd3574ccaf7c2752630e5f08 Catch exceptions from the database library --- diff --git a/src/gcm_input/gcm_input.cpp b/src/gcm_input/gcm_input.cpp index e57b6f2..4215aa4 100644 --- a/src/gcm_input/gcm_input.cpp +++ b/src/gcm_input/gcm_input.cpp @@ -7,7 +7,7 @@ *********************** ** FILE NAME : gcm_input.cpp ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.10 $ +** VERSION NUMBER : $Revision: 1.11 $ ** ** DESCRIPTION : Application to store client messages into the database ** The client message contains a log file from one of the @@ -54,7 +54,10 @@ /***************************** $Log: gcm_input.cpp,v $ - Revision 1.10 2003-09-03 06:58:31 arjen + Revision 1.11 2003-10-27 13:00:15 arjen + Catch exceptions from the database library + + Revision 1.10 2003/09/03 06:58:31 arjen Changed version string to 0.0.8 Revision 1.9 2003/09/01 06:59:26 arjen @@ -100,7 +103,7 @@ *****************************/ -static const char *RCSID = "$Id: gcm_input.cpp,v 1.10 2003-09-03 06:58:31 arjen Exp $"; +static const char *RCSID = "$Id: gcm_input.cpp,v 1.11 2003-10-27 13:00:15 arjen Exp $"; #include @@ -218,11 +221,10 @@ int main(int argc, char *argv[]) String log_method = cfg.find_parameter("logging", "method"); String log_destination = cfg.find_parameter("logging", "destination"); - int level = cfg.find_parameter("gcm_input", "level"); + int level = cfg.find_parameter("logging", "level"); if (log_method == "file" && log_destination != "") { - std::cerr << "Logging to " << log_destination << ".\n"; #if __GNUC__ == 2 logfile.open(log_destination, _IO_APPEND); // for gcc 2 #else @@ -235,9 +237,9 @@ int main(int argc, char *argv[]) else { log = &logfile; - verbose = verbose || level > 0; } } + verbose = verbose || level > 0; if (verbose) { @@ -267,7 +269,14 @@ int main(int argc, char *argv[]) if (msg.classify(hostname, arrival, service) > 0.9) { - msg.enter(); + try + { + msg.enter(); + } + catch (exception &e) + { + *log << "Caught an exception: " << e.what() << "\n"; + } } return 0; }