---
title: "FailureContext"
description: "A contextual object provided to [TestFailureHandler]s when a Compose UI test fails."
type: "class"
---
## API Reference

> Source set: Common

```kotlin
public class FailureContext(
    public val error: Throwable,
    public val artifacts: List<FailureArtifact> = emptyList(),
)
```

A contextual object provided to [TestFailureHandler](/jetpack-compose/androidx.compose.ui/ui-test/interfaces/TestFailureHandler/api)s when a Compose UI test fails.

This context encapsulates the environment of the failure, providing both the root exception that
triggered the failure and any diagnostic artifacts (such as screenshots or UI hierarchy dumps)
that were captured by the testing framework prior to invoking the custom handlers.
