---
title: Customize the Android SDK error handler
slug: feature-experimentation/docs/customize-error-handler-android
docTags: 
createdAt: 2026-08-05T20:39:53.000Z
---

To standardize error reporting across your production environment, you can provide your own custom **error handler** logic in the Optimizely Feature Experimentation Android SDK.

The SDK calls this error handler for errors such as an unknown experiment key, an unknown event key, an invalid datafile, or a user profile service failure. An unknown feature flag key does not call the error handler. The decide methods return an error decision instead.

See The following code example. If the error handler is not overridden, a no-op error handler is used by default.

```kotlin
// Error handler that raises exceptions
val errorHandler: ErrorHandler = RaiseExceptionErrorHandler()

val optimizelyManager = OptimizelyManager.builder()
         .withSDKKey("<Your_SDK_Key>")
         .withErrorHandler(errorHandler)
         .withDatafileDownloadInterval(15, TimeUnit.MINUTES)
         .build(context)
```

```java
// Error handler that raises exceptions
ErrorHandler errorHandler = new RaiseExceptionErrorHandler();

OptimizelyManager optimizelyManager = OptimizelyManager.builder()
        .withSDKKey("<Your_SDK_Key>")
        .withErrorHandler(errorHandler)
        .withDatafileDownloadInterval(15, TimeUnit.MINUTES)
        .build(context);
```
