Skip to content

Commit 95367dd

Browse files
committed
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 <pierre.europe@pm.me>
1 parent 3815f5f commit 95367dd

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/src/main/java/us/shandian/giga/postprocessing/TtmlConverter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ int process(SharpStream out, SharpStream... sources) throws IOException {
2929

3030
try {
3131
writer.build(sources[0]);
32+
} catch (IOException err) {
33+
Log.e(TAG, "subtitle conversion failed due to I/O error", err);
34+
throw err;
3235
} catch (Exception err) {
33-
Log.e(TAG, "subtitle parse failed", err);
34-
return err instanceof IOException ? 1 : 8;
36+
Log.e(TAG, "subtitle conversion failed", err);
37+
throw new IOException("TTML to SRT conversion failed", err);
3538
}
3639

3740
return OK_RESULT;

0 commit comments

Comments
 (0)