1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2026-02-22 01:49:43 +00:00

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>
This commit is contained in:
pierreeurope
2026-02-16 12:46:30 +01:00
parent 3815f5f593
commit 95367dd338

View File

@@ -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;