Skip to content

Commit

Permalink
remove unnecessary try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Apr 3, 2019
1 parent 19a82ee commit aa81e91
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/src/main/java/co/tinode/tindroid/account/SyncAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,9 @@ public void onPerformSync(final Account account, final Bundle extras, String aut
String token = AccountManager.get(mContext)
.blockingGetAuthToken(account, Utils.TOKEN_TYPE, false);
tinode.connect(hostName, tls).getResult();
try {
tinode.loginToken(token).getResult();
} catch (InProgressException ignored) {
// Skip sync at this time, will retry later.
return;
}

// It will throw if something is wrong so we will try again later.
tinode.loginToken(token).getResult();

// It throws if rejected and we just fail to sync.
tinode.subscribe(Tinode.TOPIC_FND, null, null).getResult();
Expand Down

0 comments on commit aa81e91

Please sign in to comment.