Log Exceptions When Sending Message

Also, if an exception happens, don't attempt to send a bad message file

Bug: 11538910
Change-Id: Ice82a891dd85df58fff6c4b41199ac51614ca8ba
diff --git a/src/com/android/exchange/service/EasOutboxSyncHandler.java b/src/com/android/exchange/service/EasOutboxSyncHandler.java
index 47f9aca..899719f 100644
--- a/src/com/android/exchange/service/EasOutboxSyncHandler.java
+++ b/src/com/android/exchange/service/EasOutboxSyncHandler.java
@@ -6,6 +6,7 @@
 import android.net.TrafficStats;
 import android.net.Uri;
 import android.text.format.DateUtils;
+import android.util.Log;
 
 import com.android.emailcommon.TrafficFlags;
 import com.android.emailcommon.internet.Rfc822Output;
@@ -533,6 +534,7 @@
         try {
             fileStream = new FileOutputStream(tmpFile);
         } catch (final FileNotFoundException e) {
+            Log.e(LogUtils.TAG, "Failed to create message file", e);
             return false;
         }
         try {
@@ -541,15 +543,16 @@
                     smartSend ? smartSendInfo.mRequiredAtts : null;
             Rfc822Output.writeTo(mContext, message, fileStream, smartSend, true, attachments);
         } catch (final Exception e) {
-            // TODO: Handle file write errors.
+            Log.e(LogUtils.TAG, "Failed to write message file", e);
+            return false;
         } finally {
             try {
                 fileStream.close();
             } catch (final IOException e) {
-                // TODO: Should we do anything here, or is it ok to just proceed?
+                // should not happen
+                Log.e(LogUtils.TAG, "Failed to close file - should not happen", e);
             }
         }
-
         return true;
     }