# DefaultFailureHandler

Summary:[Ctors](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler#pubctors)\|[Methods](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler#)  

# DefaultFailureHandler

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
DefaultFailureHandler
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object.html)`


``


implements

`[FailureHandler](https://developer.android.com/reference/android/support/test/espresso/FailureHandler)`


`

|---|----------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.test.espresso.base.DefaultFailureHandler |

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                             ### Public constructors                                                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[DefaultFailureHandler](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler#DefaultFailureHandler(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` appContext) ` |

|                                                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                                                        ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[handle](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler#handle(java.lang.Throwable, org.hamcrest.Matcher<android.view.View>))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` error, Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`> viewMatcher) ` Handle the given error in a manner that makes sense to the environment in which the test is executed (e.g. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler#)From interface` `[android.support.test.espresso.FailureHandler](https://developer.android.com/reference/android/support/test/espresso/FailureHandler)` ` |------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[handle](https://developer.android.com/reference/android/support/test/espresso/FailureHandler#handle(java.lang.Throwable, org.hamcrest.Matcher<android.view.View>))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` error, Matcher<`[View](https://developer.android.com/reference/android/view/View.html)`> viewMatcher) ` Handle the given error in a manner that makes sense to the environment in which the test is executed (e.g. | ||

## Public constructors

### DefaultFailureHandler

```
DefaultFailureHandler (Context appContext)
```

<br />

<br />

|           Parameters           ||
|--------------|------------------|
| `appContext` | `Context` <br /> |

## Public methods

### handle

```
void handle (Throwable error, 
                Matcher<View> viewMatcher)
```

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.

<br />

|            Parameters             ||
|---------------|--------------------|
| `error`       | `Throwable` <br /> |
| `viewMatcher` | `Matcher` <br />   |

-

  ## Annotations

  - [Default](https://developer.android.com/reference/android/support/test/espresso/base/Default)
  - [MainThread](https://developer.android.com/reference/android/support/test/espresso/base/MainThread)
  - [RootViewPickerScope](https://developer.android.com/reference/android/support/test/espresso/base/RootViewPickerScope)
-

  ## Interfaces

  - [ActiveRootLister](https://developer.android.com/reference/android/support/test/espresso/base/ActiveRootLister)
  - [IdlingUiController](https://developer.android.com/reference/android/support/test/espresso/base/IdlingUiController)
  - [InterruptableUiController](https://developer.android.com/reference/android/support/test/espresso/base/InterruptableUiController)
-

  ## Classes

  - [DefaultFailureHandler](https://developer.android.com/reference/android/support/test/espresso/base/DefaultFailureHandler)
  - [IdlingResourceRegistry](https://developer.android.com/reference/android/support/test/espresso/base/IdlingResourceRegistry)
  - [RootViewPicker](https://developer.android.com/reference/android/support/test/espresso/base/RootViewPicker)
  - [ViewFinderImpl](https://developer.android.com/reference/android/support/test/espresso/base/ViewFinderImpl)