Fix exit code on errors.
This commit is contained in:
parent
7eaf12caf6
commit
dc2e3c807f
2 changed files with 11 additions and 7 deletions
11
dosage
11
dosage
|
@ -127,8 +127,12 @@ def saveComicStrip(strip, basepath):
|
|||
|
||||
def displayHelp(comics):
|
||||
"""Print help for comic strips."""
|
||||
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
|
||||
for scraperclass in scraperclasses:
|
||||
if not adult and scraperclass.adult:
|
||||
warn_adult(scraperclass)
|
||||
|
|
|
@ -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"])
|
||||
|
|
Loading…
Reference in a new issue