Log email transcription even if ::send throws an exception.
authorCarl Hetherington <cth@carlh.net>
Fri, 8 Apr 2016 17:11:52 +0000 (18:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 8 Apr 2016 17:11:52 +0000 (18:11 +0100)
src/lib/cinema_kdms.cc

index 9fda6e2e9ca8132a711194580b785e6247f18054..d7495e9ac2cab7217539071f96ad11038e5b3de1 100644 (file)
@@ -169,7 +169,15 @@ CinemaKDMs::email (
                email.add_attachment (zip_file, name, "application/zip");
 
                Config* c = Config::instance ();
-               email.send (c->mail_server(), c->mail_port(), c->mail_user(), c->mail_password());
+
+               try {
+                       email.send (c->mail_server(), c->mail_port(), c->mail_user(), c->mail_password());
+               } catch (...) {
+                       if (log) {
+                               log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);
+                       }
+                       throw;
+               }
 
                if (log) {
                        log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);