From 40de5bf4799b1ce96be8663b3c83c0f426de2dba Mon Sep 17 00:00:00 2001 From: Joakim Holm Date: Tue, 27 Jun 2023 20:33:14 +0200 Subject: [PATCH] Add traceback in on exception in debug mode --- grawlix/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/grawlix/__main__.py b/grawlix/__main__.py index 95de72c..06d0c81 100644 --- a/grawlix/__main__.py +++ b/grawlix/__main__.py @@ -9,6 +9,7 @@ from typing import Tuple, Optional from rich.progress import Progress from functools import partial import asyncio +import traceback def get_login(source: Source, config: Config, options) -> Tuple[str, str, Optional[str]]: @@ -89,6 +90,9 @@ async def main() -> None: logging.info("") except GrawlixError as error: error.print_error() + if logging.debug_mode: + traceback.print_exc() + exit(1) async def download_with_progress(book: Book, progress: Progress, template: str):