refactor(errors): унифицировал доменные ошибки и добавил failed-статус задач

This commit is contained in:
2026-05-18 14:52:33 +03:00
parent a1226a8803
commit f3f99aed5a
38 changed files with 498 additions and 112 deletions

View File

@@ -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