diff options
| author | historia <historiavg@proton.me> | 2026-08-28 13:51:01 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-28 13:51:01 -0400 |
| commit | afb2c2d5b297c5aa28bcced0e3f90e207d799c2a (patch) | |
| tree | 80e6c336736a7c441160db8f52c9e3403497610a /audiobook.py | |
| parent | 5ed31309b6d0db94ccd566914653d367f4577c64 (diff) | |
| download | tts-audiobook-generator-afb2c2d5b297c5aa28bcced0e3f90e207d799c2a.tar.gz | |
fix: remove backtrace from console output when using incorrect/incomplete cli flags
Diffstat (limited to 'audiobook.py')
| -rwxr-xr-x | audiobook.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/audiobook.py b/audiobook.py index 0d0f5d7..811ffdf 100755 --- a/audiobook.py +++ b/audiobook.py @@ -187,8 +187,14 @@ def convert(backend: str = None, voice: str = None, clone: str = None, print("\n[WARNING] Shutdown requested by user") return 130 except Exception as exc: + # Expected failures (bad flags, unreachable server, missing voice) + # raise RuntimeError/ValueError with an actionable message: show + # that once and keep the full traceback in the dated log file. + # Anything else is an actual crash, so also show the traceback. + logging_kit.log_traceback() print(f"[FATAL] Fatal error: {exc}") - traceback.print_exc() + if not isinstance(exc, (RuntimeError, ValueError)): + traceback.print_exc() if progress is not None: progress({"kind": "error", "message": str(exc)}) return 1 |
