Add subtitle parser errors to log if available (#12479)

This commit is contained in:
Łukasz
2024-09-06 15:47:06 +02:00
committed by GitHub
parent cd95eabcc6
commit 1451cbc39e
3 changed files with 47 additions and 6 deletions

View File

@@ -54,12 +54,23 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
break;
}
_logger.LogError(
"{ErrorCount} errors encountered while parsing '{FileExtension}' subtitle using the {SubtitleFormatParser} format parser",
subtitleFormat.ErrorCount,
fileExtension,
subtitleFormat.Name);
else if (subtitleFormat.TryGetErrors(out var errors))
{
_logger.LogError(
"{ErrorCount} errors encountered while parsing '{FileExtension}' subtitle using the {SubtitleFormatParser} format parser, errors: {Errors}",
subtitleFormat.ErrorCount,
fileExtension,
subtitleFormat.Name,
errors);
}
else
{
_logger.LogError(
"{ErrorCount} errors encountered while parsing '{FileExtension}' subtitle using the {SubtitleFormatParser} format parser",
subtitleFormat.ErrorCount,
fileExtension,
subtitleFormat.Name);
}
}
if (subtitle.Paragraphs.Count == 0)