]> git.ktnx.net Git - mobile-ledger.git/commitdiff
interpret only json-parsing exceptions as API mismatch
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 20 Apr 2021 19:44:12 +0000 (22:44 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 20 Apr 2021 19:44:12 +0000 (22:44 +0300)
all others, like no Internet, bad host name etc should be reported as
usual

app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java

index 8ac793663eb686ccc00d428db93b965ef8c4a2f8..88c3ee8300e1da0efe1020854b80429a70c84fdb 100644 (file)
@@ -25,6 +25,7 @@ import android.os.OperationCanceledException;
 import androidx.annotation.NonNull;
 import androidx.room.Transaction;
 
+import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.databind.RuntimeJsonMappingException;
 
 import net.ktnx.mobileledger.App;
@@ -407,15 +408,16 @@ public class RetrieveTransactionsTask extends
             return retrieveAccountListForVersion(apiVersion);
         }
     }
-    private List<LedgerAccount> retrieveAccountListAnyVersion() throws ApiNotSupportedException {
+    private List<LedgerAccount> retrieveAccountListAnyVersion()
+            throws ApiNotSupportedException, IOException, HTTPException {
         for (API ver : API.allVersions) {
             try {
                 return retrieveAccountListForVersion(ver);
             }
-            catch (Exception e) {
+            catch (JsonParseException | RuntimeJsonMappingException e) {
                 Logger.debug("json",
                         String.format(Locale.US, "Error during account list retrieval using API %s",
-                                ver.getDescription()));
+                                ver.getDescription()), e);
             }
 
         }