From 9214f0eb3c8066ba88a6644d50e7444119bcc8df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Sat, 29 Dec 2007 05:56:35 +0000 Subject: [PATCH] Print error code in log file on error --- sls/trunk/src/sls.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sls/trunk/src/sls.cc b/sls/trunk/src/sls.cc index 9c4e023..a6344a6 100644 --- a/sls/trunk/src/sls.cc +++ b/sls/trunk/src/sls.cc @@ -77,9 +77,20 @@ int main(int argc, char *argv[]) return ERR_NO; } catch (const Error &e) { - if (S.started()) S.stop(); - if (D.opened()) D.close(); + // Close server if started + if (S.started()) + S.stop(); + + // Save data in database + if (D.opened()) + D.close(); + + // print error e.print(); + + // Print exit code if in daemon and verbose mode + if (O.daemon && O.verbose) std::cerr << "Exit with code: " << e.code() << std::endl; + return e.code(); } } -- GitLab