diff --git a/dosage b/dosage index 23df98b14..e63e2c4d3 100755 --- a/dosage +++ b/dosage @@ -127,8 +127,12 @@ def saveComicStrip(strip, basepath): def displayHelp(comics): """Print help for comic strips.""" - for scraperobj in getScrapers(comics): - displayComicHelp(scraperobj) + try: + for scraperobj in getScrapers(comics): + displayComicHelp(scraperobj) + except ValueError as msg: + out.error(msg) + return 1 return 0 @@ -157,6 +161,9 @@ def getComics(options): try: for scraperobj in getScrapers(options.comic, options.basepath, options.adult, options.multimatch): errors += getStrips(scraperobj, options) + except ValueError as msg: + out.error(msg) + errors += 1 finally: events.getHandler().end() return errors @@ -293,11 +300,7 @@ def getScrapers(comics, basepath=None, adult=True, multiple_allowed=False): else: name = comic indexes = None - try: - scraperclasses = scraper.find_scraperclasses(name, multiple_allowed=multiple_allowed) - except ValueError as msg: - out.error(msg) - continue + scraperclasses = scraper.find_scraperclasses(name, multiple_allowed=multiple_allowed) for scraperclass in scraperclasses: if not adult and scraperclass.adult: warn_adult(scraperclass) diff --git a/tests/test_dosage.py b/tests/test_dosage.py index eb80bcd22..e030bb5e0 100644 --- a/tests/test_dosage.py +++ b/tests/test_dosage.py @@ -51,6 +51,7 @@ class TestDosage (unittest.TestCase): def test_error(self): self.assertRaises(OSError, run_with_options, []) self.assertRaises(OSError, run_with_options, ['--imadoofus']) + self.assertRaises(OSError, run_with_options, ['Garfield']) def test_fetch_html(self): run_with_options(["-n", "2", "-b", self.tmpdir, "-o", "html", "-o", "rss", "calvinandhobbes"])