# ErrorRecovery

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.ErrorRecovery) Added in [3.2.0](https://developer.android.com/jetpack/androidx/releases/paging#3.2.0)

*** ** * ** ***


```
@VisibleForTesting
public enum ErrorRecovery extends Enum<@NonNull ErrorRecovery>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [kotlin.Enum](https://developer.android.com/reference/java/lang/Enum.html)\<@[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) [ErrorRecovery](https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery)\> ||
|   | ↳ | [androidx.paging.testing.ErrorRecovery](https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery) |

*** ** * ** ***

The method of recovery when `https://developer.android.com/reference/androidx/paging/PagingSource` returns `https://developer.android.com/reference/androidx/paging/PagingSource.LoadResult.Error`. The error is indicated when `https://developer.android.com/reference/androidx/paging/PagingDataPresenter#loadStateFlow()` emits a `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` where one or more of the `https://developer.android.com/reference/androidx/paging/LoadState` is `https://developer.android.com/reference/androidx/paging/LoadState.Error`.

## Summary

| ### Enum Values |
|---|---|
| `https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery#RETRY` | Retry the failed load. |
| `https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery#RETURN_CURRENT_SNAPSHOT` | Returns a snapshot with any data that has been loaded up till the point of error. |
| `https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery#THROW` | Rethrow the original `https://developer.android.com/reference/androidx/paging/LoadState.Error#error()` that was caught when loading from the data source. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html<@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/ErrorRecovery#getEntries()()` Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared. |
| `static final @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/ErrorRecovery#valueOf(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html value)` Returns the enum constant of this type with the specified name. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull ErrorRecovery[]` | `https://developer.android.com/reference/androidx/paging/testing/ErrorRecovery#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

## Enum Values

### RETRY

```
@VisibleForTesting
ErrorRecovery ErrorRecovery.RETRY
```

Retry the failed load. This does not guarantee a successful load as the data source may still return an error.

### RETURN_CURRENT_SNAPSHOT

```
@VisibleForTesting
ErrorRecovery ErrorRecovery.RETURN_CURRENT_SNAPSHOT
```

Returns a snapshot with any data that has been loaded up till the point of error.

### THROW

```
@VisibleForTesting
ErrorRecovery ErrorRecovery.THROW
```

Rethrow the original `https://developer.android.com/reference/androidx/paging/LoadState.Error#error()` that was caught when loading from the data source.

## Public methods

### getEntries

```
public final @NonNull EnumEntries<@NonNull ErrorRecovery> getEntries()
```

Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared.

### valueOf

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

```
public static final @NonNull ErrorRecovery valueOf(@NonNull String value)
```

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if this enum type has no constant with the specified name |

### values

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

```
public static final @NonNull ErrorRecovery[] values()
```

Returns an array containing the constants of this enum type, in the order they're declared.

This method may be used to iterate over the constants.

The function returns a new instance of the array on every call. The array could be mutated, so working with it may also require defensive copying. Consider using `entries` property as a more efficient alternative returning an immutable list of enum entries.