Fix erroneous thread affinity log message.
[dcpomatic.git] / src / lib / cinema_kdms.cc
index 9fda6e2e9ca8132a711194580b785e6247f18054..318eebe3996af238156e3ce0e7c9b4bed9376faa 100644 (file)
@@ -169,9 +169,23 @@ 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 content follows", LogEntry::TYPE_DEBUG_EMAIL);
+                               log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL);
+                               log->log ("Email session follows", LogEntry::TYPE_DEBUG_EMAIL);
+                               log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);
+                       }
+                       throw;
+               }
 
                if (log) {
+                       log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL);
+                       log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL);
+                       log->log ("Email session follows", LogEntry::TYPE_DEBUG_EMAIL);
                        log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);
                }
        }