KmpWorkerException

Base class for all exceptions thrown by KMPWorker.

Use the specific subclasses to handle individual error conditions:

try {
kmpWorker.enqueue(request)
} catch (e: KmpWorkerException.TaskAlreadyEnqueuedException) {
// task is already scheduled — safe to ignore or cancel first
}

Inheritors

Types

Link copied to clipboard
class ChainExecutionException(val chainId: String, val failedStepId: String, cause: Throwable) : KmpWorkerException

Thrown when a TaskChain fails at one of its steps and cannot continue. The chain transitions to a failed state; already-completed steps are not rolled back.

Link copied to clipboard

Thrown when a TaskRequest is constructed with invalid parameters — e.g. a blank TaskRequest.id or a negative repeat interval.

Link copied to clipboard

Thrown when KmpWorker.enqueue is called with an id that is already active (Scheduled or Running) and the caller did not set replaceExisting = true.

Link copied to clipboard

Thrown when KmpWorker.observe, KmpWorker.cancel, or KmpWorker.getState references a task ID that has never been registered or has been purged.

Link copied to clipboard
class TaskTimeoutException(val taskId: String, val timeoutMillis: Long) : KmpWorkerException

Thrown when a task exceeds KmpWorkerConfig.taskTimeout and is forcefully stopped. The task transitions to TaskState.TimedOut before this exception propagates.

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
open val message: String?