# LoadErrorHandler

Artifact: [androidx.paging:paging-testing](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/testing/LoadErrorHandler.kt+class:androidx.paging.testing.LoadErrorHandler) Added in [3.2.0](https://developer.android.com/jetpack/androidx/releases/paging#3.2.0)

*** ** * ** ***


```
@VisibleForTesting
public fun interface LoadErrorHandler
```

<br />

*** ** * ** ***

An interface to implement the error recovery strategy when `https://developer.android.com/reference/androidx/paging/PagingSource` returns a `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult.Error`.

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery` | `https://developer.android.com/reference/androidx/paging/testing/LoadErrorHandler#onError(androidx.paging.CombinedLoadStates)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/CombinedLoadStates combinedLoadStates)` The lambda that should return an `https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery` given the `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` indicating which `https://developer.android.com/reference/androidx/paging/LoadState` contains the `https://developer.android.com/reference/androidx/paging/LoadState.Error`. |

## Public methods

### onError

Added in [3.2.0](https://developer.android.com/jetpack/androidx/releases/paging#3.2.0)

```
abstract @NonNull ErrorRecovery onError(@NonNull CombinedLoadStates combinedLoadStates)
```

The lambda that should return an `https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery` given the `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` indicating which `https://developer.android.com/reference/androidx/paging/LoadState` contains the `https://developer.android.com/reference/androidx/paging/LoadState.Error`.

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