diff --git a/mangadlp/cli.py b/mangadlp/cli.py index 89b1bb2..7f8361c 100644 --- a/mangadlp/cli.py +++ b/mangadlp/cli.py @@ -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}") diff --git a/tests/test_01_app.py b/tests/test_01_app.py index 3da6ee6..bad76bc 100644 --- a/tests/test_01_app.py +++ b/tests/test_01_app.py @@ -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