Only clear sync error map on success

We don't want to clear the error map unless there was a successful
sync.  Otherwise, the device will attempt a sync evert 15 seconds

This is the first part of the fix for bug 7567773

Change-Id: Icd0e70d87a7f588e242f0f100ee0b36b3aa85d89
diff --git a/exchange2/src/com/android/exchange/EasAccountService.java b/exchange2/src/com/android/exchange/EasAccountService.java
index 58ddaf3..533a5df 100644
--- a/exchange2/src/com/android/exchange/EasAccountService.java
+++ b/exchange2/src/com/android/exchange/EasAccountService.java
@@ -679,8 +679,6 @@
                         }
 
                         if (code == HttpStatus.SC_OK) {
-                            // Make sure to clear out any pending sync errors
-                            ExchangeService.removeFromSyncErrorMap(mMailboxId);
                             if (!resp.isEmpty()) {
                                 InputStream is = resp.getInputStream();
                                 int pingResult = parsePingResult(is, mContentResolver,
@@ -708,6 +706,8 @@
                                     // Act as if we have an IOException (backoff, etc.)
                                     throw new IOException();
                                 }
+                                // Make sure to clear out any pending sync errors
+                                ExchangeService.removeFromSyncErrorMap(mMailboxId);
                             } else {
                                 userLog("Ping returned empty result; throwing IOException");
                                 throw new IOException();