mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 05:40:26 +02:00
Refactor segment processing with overflow error handling
fix: catch OverflowError in emit_text for very large numbers Fixes #145 When text contains a very large number (e.g. a long decimal from a binary hash), misaki's pipeline calls num2words() which raises OverflowError and crashes the entire job. Wrap the segment iterator in try/except so the chunk is skipped gracefully with a warning log instead of terminating.
This commit is contained in:
@@ -1868,6 +1868,7 @@ def run_conversion_job(job: Job) -> None:
|
||||
split_pattern=split_pattern,
|
||||
)
|
||||
|
||||
try:
|
||||
for segment in segment_iter:
|
||||
canceller()
|
||||
graphemes_raw = getattr(segment, "graphemes", "") or ""
|
||||
@@ -1907,6 +1908,11 @@ def run_conversion_job(job: Job) -> None:
|
||||
if audio_sink:
|
||||
current_time += duration
|
||||
|
||||
except OverflowError as exc:
|
||||
job.add_log(
|
||||
f"Skipped chunk — number too large for TTS conversion: {exc}",
|
||||
level="warning",
|
||||
)
|
||||
return local_segments
|
||||
|
||||
def append_silence(
|
||||
|
||||
Reference in New Issue
Block a user