ReThrowCorruptionHandler



Default corruption handler which does nothing but rethrow the exception.

Summary

Public constructors

Cmn
android
N
JS

Public functions

open suspend T

This function will be called by DataStore when it encounters corruption.

Cmn
android
N
JS

Public constructors

ReThrowCorruptionHandler

<T : Any?> ReThrowCorruptionHandler()

ReThrowCorruptionHandler

<T : Any?> ReThrowCorruptionHandler()

ReThrowCorruptionHandler

<T : Any?> ReThrowCorruptionHandler()

ReThrowCorruptionHandler

<T : Any?> ReThrowCorruptionHandler()

Public functions

handleCorruption

open suspend fun handleCorruption(ex: CorruptionException): T

This function will be called by DataStore when it encounters corruption. If the implementation of this function throws an exception, it will be propagated to the original call to DataStore. Otherwise, the returned data will be written to disk.

This function should not interact with any DataStore API - doing so can result in a deadlock.

Parameters
ex: CorruptionException

is the exception encountered when attempting to deserialize data from disk.

Returns
T

The value that DataStore should attempt to write to disk.