Adjustment to error logging
This commit is contained in:
parent
a174fe2aea
commit
a395efdbd9
@ -2,6 +2,7 @@ package no.iktdev.streamit.content.convert
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import mu.KotlinLogging
|
||||
import no.iktdev.library.subtitle.Syncro
|
||||
import no.iktdev.library.subtitle.export.Export
|
||||
import no.iktdev.library.subtitle.reader.BaseReader
|
||||
@ -11,6 +12,9 @@ import no.iktdev.streamit.content.common.dto.reader.work.ConvertWork
|
||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
||||
import java.io.File
|
||||
|
||||
private val logger = KotlinLogging.logger {}
|
||||
|
||||
|
||||
class ConvertRunner(val referenceId: String, val listener: IConvertListener) {
|
||||
|
||||
private fun getReade(inputFile: File): BaseReader? {
|
||||
@ -22,6 +26,7 @@ class ConvertRunner(val referenceId: String, val listener: IConvertListener) {
|
||||
val reader = getReade(inFile)
|
||||
val dialogs = reader?.read()
|
||||
if (dialogs.isNullOrEmpty()) {
|
||||
logger.error { "$referenceId ${subtitleInfo.inputFile}: Dialogs read from file is null or empty!" }
|
||||
withContext(Dispatchers.Default) {
|
||||
listener.onError(referenceId, subtitleInfo, "Dialogs read from file is null or empty!")
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ class SubtitleConsumer: DefaultKafkaReader("convertHandlerSubtitle"), IConvertLi
|
||||
}
|
||||
|
||||
override fun onError(referenceId: String, info: SubtitleInfo, message: String) {
|
||||
produceMessage(KafkaEvents.EVENT_CONVERTER_SUBTITLE_FILE_ENDED, Message(referenceId = referenceId, Status(statusType = StatusType.ERROR)), null)
|
||||
produceMessage(KafkaEvents.EVENT_CONVERTER_SUBTITLE_FILE_ENDED, Message(referenceId = referenceId, Status(statusType = StatusType.ERROR, message = message)), null)
|
||||
}
|
||||
|
||||
override fun onEnded(referenceId: String, info: SubtitleInfo, work: ConvertWork) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user