refactor(errors): унифицировал доменные ошибки и добавил failed-статус задач
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.github.nullptroma.wallenc.usecases
|
||||
|
||||
import com.github.nullptroma.wallenc.domain.errors.toWallencException
|
||||
import com.github.nullptroma.wallenc.domain.interfaces.IStorageSyncEngine
|
||||
import com.github.nullptroma.wallenc.domain.tasks.ITaskOrchestrator
|
||||
import com.github.nullptroma.wallenc.domain.tasks.TaskId
|
||||
@@ -46,8 +47,10 @@ class RunStorageSyncUseCase(
|
||||
ctx.log(TaskLogLevel.Info, "Storage sync finished")
|
||||
ctx.reportProgress(null, "Storage sync: completed")
|
||||
} catch (e: Exception) {
|
||||
ctx.log(TaskLogLevel.Error, "Storage sync failed: ${e.message}")
|
||||
ctx.reportProgress(null, "Storage sync: failed - ${e.message}")
|
||||
val err = e.toWallencException()
|
||||
ctx.log(TaskLogLevel.Error, "Storage sync failed: $err")
|
||||
ctx.reportProgress(null, "Storage sync: failed - $err")
|
||||
ctx.fail(err)
|
||||
} finally {
|
||||
running.set(false)
|
||||
_syncRunning.value = false
|
||||
|
||||
Reference in New Issue
Block a user