From 95367dd338efa7f9bfc7707aa648c54997d5f72e Mon Sep 17 00:00:00 2001 From: pierreeurope Date: Mon, 16 Feb 2026 12:46:30 +0100 Subject: [PATCH] Fix subtitle post-processing error losing original exception Previously, TtmlConverter.process() caught all exceptions during TTML to SRT conversion and returned opaque error codes (1 for IOException, 8 for other exceptions). These error codes were then wrapped by Postprocessing.run() into a generic RuntimeException with the message 'post-processing algorithm returned N', losing the original exception and its stack trace. This made it impossible for users and developers to diagnose the root cause of subtitle download failures, as reported in #13206. Now, IOExceptions are re-thrown directly, and other exceptions are wrapped in an IOException with the original exception as the cause. This allows DownloadMission.doPostprocessing() to properly catch and report the actual error, including the full stack trace in the crash report. Fixes #13206 Signed-off-by: pierreeurope --- .../us/shandian/giga/postprocessing/TtmlConverter.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/us/shandian/giga/postprocessing/TtmlConverter.java b/app/src/main/java/us/shandian/giga/postprocessing/TtmlConverter.java index 8ed0dfae5..d723bfb45 100644 --- a/app/src/main/java/us/shandian/giga/postprocessing/TtmlConverter.java +++ b/app/src/main/java/us/shandian/giga/postprocessing/TtmlConverter.java @@ -29,9 +29,12 @@ class TtmlConverter extends Postprocessing { try { writer.build(sources[0]); + } catch (IOException err) { + Log.e(TAG, "subtitle conversion failed due to I/O error", err); + throw err; } catch (Exception err) { - Log.e(TAG, "subtitle parse failed", err); - return err instanceof IOException ? 1 : 8; + Log.e(TAG, "subtitle conversion failed", err); + throw new IOException("TTML to SRT conversion failed", err); } return OK_RESULT;