onException

open suspend fun PipelineContext<S, I, A>.onException(e: Exception): Exception?

A callback that is invoked when Store handles an exception. This is invoked before the exception is rethrown or otherwise processed. This is invoked asynchronously in a background job and after the job that has thrown was cancelled, meaning that some time may pass after the job is cancelled and the exception is handled. Handled exceptions do not result in Store.close.

  • Return null to signal that the exception has been handled and recovered from, continuing the flow's processing.

  • Return e if the exception was not handled and should be passed to other plugins.

  • Execute other operations using PipelineContext.

If none of the plugins handles the exception (returns null), the exception is rethrown and the store fails. Register a pro.respawn.flowmvi.plugins.recoverPlugin to recover from all exceptions.