Skip to content

Commit

Permalink
add exit for single manga
Browse files Browse the repository at this point in the history
olofvndrhr committed Feb 12, 2023
1 parent 5eb333f commit d64964e
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions mangadlp/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from pathlib import Path

import click
@@ -276,6 +277,11 @@ def main(
)
mdlp.get_manga()
except (KeyboardInterrupt, Exception) as exc:
# if only a single manga is requested and had an error, then exit
if len(requested_mangas) == 1:
log.error(f"Error with manga: {manga}")
sys.exit(1)
# else continue with the other ones
log.error(f"Skipping: {manga}. Reason={exc}")


5 changes: 2 additions & 3 deletions tests/test_01_app.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ def test_check_api_mangadex():

def test_check_api_none():
url = "https://abc.defghjk/title/abc/def"
with pytest.raises(SystemExit) as e:
with pytest.raises(ValueError) as e:
MangaDLP(url_uuid=url, list_chapters=True, download_wait=2)
assert e.type == SystemExit
assert e.value.code == 1
assert e.type == ValueError

0 comments on commit d64964e

Please sign in to comment.