rewrite the way to use onStateHandlingErrorHandler inside of DefaultStatesMachine

This commit is contained in:
InsanusMokrassar 2022-05-19 20:42:05 +06:00
parent b22fbfb3bc
commit 18908a01d7

View File

@ -71,7 +71,11 @@ open class DefaultStatesMachine <T: State>(
/** /**
* Will call [launchStateHandling] for state handling * Will call [launchStateHandling] for state handling
*/ */
override suspend fun StatesMachine<in T>.handleState(state: T): T? = launchStateHandling(state, handlers, onStateHandlingErrorHandler) override suspend fun StatesMachine<in T>.handleState(state: T): T? = launchStateHandling(state, handlers)
override suspend fun launchStateHandling(state: T, handlers: List<CheckableHandlerHolder<in T, T>>): T? {
return launchStateHandling(state, handlers, onStateHandlingErrorHandler)
}
/** /**
* This * This
@ -80,7 +84,7 @@ open class DefaultStatesMachine <T: State>(
protected val statesJobsMutex = Mutex() protected val statesJobsMutex = Mutex()
protected open suspend fun performUpdate(state: T) { protected open suspend fun performUpdate(state: T) {
val newState = launchStateHandling(state, handlers, onStateHandlingErrorHandler) val newState = launchStateHandling(state, handlers)
if (newState != null) { if (newState != null) {
statesManager.update(state, newState) statesManager.update(state, newState)
} else { } else {