From c3b82fff327a0aa680d688dc5c5a5ddd358161d5 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Sun, 11 Jan 2015 05:39:36 -0800 Subject: [PATCH] Better messaging when instagram rips fail For #129 --- .../java/com/rarchives/ripme/ripper/AbstractRipper.java | 6 +++++- .../rarchives/ripme/ripper/rippers/InstagramRipper.java | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java index bedc371c..e7292fee 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java @@ -328,11 +328,15 @@ public abstract class AbstractRipper } catch (HttpStatusException e) { logger.error("Got exception while running ripper:", e); waitForThreads(); - sendUpdate(STATUS.RIP_ERRORED, "Status=" + e.getStatusCode() + ", URL=" + e.getUrl()); + sendUpdate(STATUS.RIP_ERRORED, "HTTP status code " + e.getStatusCode() + " for URL " + e.getUrl()); } catch (IOException e) { logger.error("Got exception while running ripper:", e); waitForThreads(); sendUpdate(STATUS.RIP_ERRORED, e.getMessage()); + } catch (Exception e) { + logger.error("Got exception while running ripper:", e); + waitForThreads(); + sendUpdate(STATUS.RIP_ERRORED, e.getMessage()); } finally { cleanup(); } diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java index 95a2a0c9..9de14f86 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java @@ -9,6 +9,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -109,7 +110,12 @@ public class InstagramRipper extends AbstractJSONRipper { String baseURL = "http://iconosquare.com/controller_nl.php?action=getPhotoUserPublic&user_id=" + userID; logger.info("Loading " + baseURL); - return Http.url(baseURL).getJSON(); + try { + JSONObject result = Http.url(baseURL).getJSON(); + return result; + } catch (JSONException e) { + throw new IOException("Could not get instagram user via iconosquare", e); + } } @Override