Better messaging when instagram rips fail

For #129
This commit is contained in:
4pr0n 2015-01-11 05:39:36 -08:00
parent 083cd8d7cc
commit c3b82fff32
2 changed files with 12 additions and 2 deletions

View File

@ -328,11 +328,15 @@ public abstract class AbstractRipper
} catch (HttpStatusException e) { } catch (HttpStatusException e) {
logger.error("Got exception while running ripper:", e); logger.error("Got exception while running ripper:", e);
waitForThreads(); 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) { } catch (IOException e) {
logger.error("Got exception while running ripper:", e); logger.error("Got exception while running ripper:", e);
waitForThreads(); waitForThreads();
sendUpdate(STATUS.RIP_ERRORED, e.getMessage()); 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 { } finally {
cleanup(); cleanup();
} }

View File

@ -9,6 +9,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; 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=" String baseURL = "http://iconosquare.com/controller_nl.php?action=getPhotoUserPublic&user_id="
+ userID; + userID;
logger.info("Loading " + baseURL); 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 @Override