]> git.ktnx.net Git - mobile-ledger.git/commitdiff
maybe better network error reporting
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 8 Dec 2018 12:17:19 +0000 (12:17 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 8 Dec 2018 12:17:19 +0000 (12:17 +0000)
app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java

index 0956f63822b74bae4bd8efb291853d38f8485a91..5c099c8a9fed5c8b9138a2c9b6e54aa3c0a4ef53 100644 (file)
@@ -26,6 +26,10 @@ abstract public class RetrieveAccountsTask extends android.os.AsyncTask<Void, In
         error = 0;
     }
 
+    void setPref(SharedPreferences pref) {
+        this.pref = pref;
+    }
+
     protected Void doInBackground(Void... params) {
         try {
             HttpURLConnection http = NetworkUtil.prepare_connection( pref, "add");
@@ -36,7 +40,7 @@ abstract public class RetrieveAccountsTask extends android.os.AsyncTask<Void, In
             try {
                 Log.d("update_accounts", String.valueOf(http.getResponseCode()));
                 if (http.getResponseCode() != 200) {
-                    throw new IOException(String.valueOf(R.string.err_http_error));
+                    throw new IOException(String.format("HTTP error: %d %s", http.getResponseCode(), http.getResponseMessage()));
                 }
                 else {
                     if (db.inTransaction()) throw new AssertionError();