From a2d8693b0474647492c745eef7ae37869defbfdf Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 22 Mar 2018 08:33:18 +0100 Subject: [PATCH] Skip bad stories instead of aborting the process --- src/be/nikiroo/gofetch/Fetcher.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/be/nikiroo/gofetch/Fetcher.java b/src/be/nikiroo/gofetch/Fetcher.java index bd5a454..258f196 100644 --- a/src/be/nikiroo/gofetch/Fetcher.java +++ b/src/be/nikiroo/gofetch/Fetcher.java @@ -147,12 +147,20 @@ public class Fetcher { // Get comments (and update stories if needed): int i = 1; + List fetchedStories = new ArrayList(stories.size()); for (Story story : stories) { - System.err.println(String.format("%02d/%02d", i, stories.size()) + System.err.print(String.format("%02d/%02d", i, stories.size()) + " Fetching full story " + story.getId() + "..."); - support.fetch(story); + try { + support.fetch(story); + fetchedStories.add(story); + System.err.println(); + } catch (IOException e) { + System.err.println(" Failed to get story!"); + } i++; } + stories = fetchedStories; Output gopher = new Gopher(support.getType(), hostname, preselector, port); -- 2.27.0