# DefaultFailureHandler

Artifact: [androidx.test.espresso:espresso-core](https://developer.android.com/jetpack/androidx/releases/test-espresso) [View Source](https://cs.android.com/search?q=file:androidx/test/espresso/base/DefaultFailureHandler.java+class:androidx.test.espresso.base.DefaultFailureHandler)

*** ** * ** ***


```
class DefaultFailureHandler : FailureHandler
```

<br />

*** ** * ** ***

Espresso's default `https://developer.android.com/reference/kotlin/androidx/test/espresso/FailureHandler`. If this does not fit your needs, feel free to provide your own implementation via Espresso.setFailureHandler(FailureHandler).

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/DefaultFailureHandler#DefaultFailureHandler(android.content.Context)(appContext: https://developer.android.com/reference/android/content/Context.html!)` |
| `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/DefaultFailureHandler#DefaultFailureHandler(android.content.Context,boolean)( appContext: https://developer.android.com/reference/android/content/Context.html!, captureScreenshotOnFailure: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/DefaultFailureHandler#handle(java.lang.Throwable,org.hamcrest.Matcher<android.view.View>)(error: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html!, viewMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/view/View.html!>!)` Handle the given error in a manner that makes sense to the environment in which the test is executed (e.g. take a screenshot, output extra debug info, etc). |

## Public constructors

### DefaultFailureHandler

```
DefaultFailureHandler(appContext: Context!)
```

### DefaultFailureHandler

```
DefaultFailureHandler(
    appContext: Context!,
    captureScreenshotOnFailure: Boolean
)
```

## Public functions

### handle

```
fun handle(error: Throwable!, viewMatcher: Matcher<View!>!): Unit
```

Handle the given error in a manner that makes sense to the environment in which the test is executed (e.g. take a screenshot, output extra debug info, etc). Upon handling, most handlers will choose to propagate the error.