refactor: 为回调增加异常捕获, 以避免因回调抛出异常而打断上传任务.
This commit is contained in:
parent
43b9d5f182
commit
98e256f4db
@ -131,9 +131,18 @@ class OneDriveTransferTaskExecutor(
|
|||||||
threadStatusMap[id] = progress
|
threadStatusMap[id] = progress
|
||||||
try {
|
try {
|
||||||
callback.onTransferStart(progress)
|
callback.onTransferStart(progress)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.warn(e) { "OneDrive 中转任务开始回调失败: ${e.message}" }
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
doTransferFile(task, progress)
|
doTransferFile(task, progress)
|
||||||
logger.info { "OneDrive 中转任务执行成功: ${task.document.fileName}" }
|
logger.info { "OneDrive 中转任务执行成功: ${task.document.fileName}" }
|
||||||
callback.onTransferSuccess(task, progress)
|
try {
|
||||||
|
callback.onTransferSuccess(task, progress)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.warn(e) { "OneDrive 中转任务成功回调失败: ${e.message}" }
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.warn(e) { "OneDrive 中转任务执行失败: ${e.message}" }
|
logger.warn(e) { "OneDrive 中转任务执行失败: ${e.message}" }
|
||||||
callback.onTransferFailure(task, progress.apply {
|
callback.onTransferFailure(task, progress.apply {
|
||||||
|
Loading…
Reference in New Issue
Block a user