Skip to content

Commit f770cdd

Browse files
committed
feat: job被取消时抛出异常
1 parent fdc2e45 commit f770cdd

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

core/src/main/kotlin/io/github/shoaky/sourcedownloader/core/processor/SourceProcessor.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,16 +689,17 @@ class SourceProcessor(
689689
processJob.join()
690690

691691
secondaryFileMover.releaseAll()
692-
if (processJob.isCancelled) {
693-
val ex = processJob.getCancellationException()
694-
log.info("Processor:'{}' process job cancelled, message:{}", name, ex.message)
695-
}
696-
697692
stat.stopWatch.stop()
698693
onProcessCompleted(context)
699694
if (stat.hasChange()) {
700695
log.info("Processor:{}", stat)
701696
}
697+
698+
if (processJob.isCancelled) {
699+
val ex = processJob.getCancellationException().cause ?: processJob.getCancellationException()
700+
log.info("Processor:'{}' process job cancelled, message:{}", name, ex.message)
701+
throw ex
702+
}
702703
}
703704

704705
protected open fun whenItemErrorReturning(

0 commit comments

Comments
 (0)