LoadErrorHandler


@VisibleForTesting
public fun interface LoadErrorHandler


An interface to implement the error recovery strategy when PagingSource returns a LoadResult.Error.

Summary

Public methods

abstract @NonNull ErrorRecovery
onError(@NonNull CombinedLoadStates combinedLoadStates)

The lambda that should return an ErrorRecovery given the CombinedLoadStates indicating which LoadState contains the LoadState.Error.

Public methods

onError

Added in 3.2.0
abstract @NonNull ErrorRecovery onError(@NonNull CombinedLoadStates combinedLoadStates)

The lambda that should return an ErrorRecovery given the CombinedLoadStates indicating which LoadState contains the LoadState.Error.

Sample use case: val onError = LoadErrorHandler { combinedLoadStates -> if (combinedLoadStates.refresh is LoadResult.Error) { ErrorRecovery.RETRY } else { ErrorRecovery.THROW } }