From f7ec3181797b012b197e01317d0c691fbbe4036a Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 2 Apr 2013 21:21:50 +0530 Subject: [PATCH] Remove RuntimExceptions on transient errors --- .../ModificationsSyncAdapter.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/commons/src/main/java/org/wikimedia/commons/modifications/ModificationsSyncAdapter.java b/commons/src/main/java/org/wikimedia/commons/modifications/ModificationsSyncAdapter.java index 53dedce8e..dcbf2793c 100644 --- a/commons/src/main/java/org/wikimedia/commons/modifications/ModificationsSyncAdapter.java +++ b/commons/src/main/java/org/wikimedia/commons/modifications/ModificationsSyncAdapter.java @@ -50,7 +50,8 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter { } catch (OperationCanceledException e) { throw new RuntimeException(e); } catch (IOException e) { - throw new RuntimeException(e); + Log.d("Commons", "Could not authenticate :("); + return; } catch (AuthenticatorException e) { throw new RuntimeException(e); } @@ -63,7 +64,8 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter { try { editToken = api.getEditToken(); } catch (IOException e) { - throw new RuntimeException(e); + Log.d("Commons", "Can not retreive edit token!"); + return; } @@ -98,7 +100,8 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter { .param("titles", contrib.getFilename()) .get(); } catch (IOException e) { - throw new RuntimeException(e); + Log.d("Commons", "Network fuckup on modifications sync!"); + continue; } Log.d("Commons", "Page content is " + Utils.getStringFromDOM(requestResult.getDocument())); @@ -113,17 +116,19 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter { .param("summary", sequence.getEditSummary()) .post(); } catch (IOException e) { - throw new RuntimeException(e); + Log.d("Commons", "Network fuckup on modifications sync!"); + continue; } Log.d("Commons", "Response is" + Utils.getStringFromDOM(responseResult.getDocument())); String result = responseResult.getString("/api/edit/@result"); if(!result.equals("Success")) { - throw new RuntimeException(); + // FIXME: Log this somewhere else + Log.d("Commons", "Non success result!" + result); + } else { + sequence.delete(); } - - sequence.delete(); } allModifications.moveToNext();