Optimizely will be sunsetting Full Stack Experimentation on July 29, 2024. See the recommended Feature Experimentation migration timeline and documentation.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySumbit a ticketLog In
GitHubNuGetDev CommunitySumbit a ticket

Customize error handler

This topic describes how to create your own error handler logic.

You can provide your own custom error handler logic to standardize across your production environment.

This error handler is called when an unknown feature key is referenced.

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

import com.optimizely.ab.android.sdk.OptimizelyManager;
import com.optimizely.ab.error.ErrorHandler;

// Default handler that raises exceptions
ErrorHandler errorHandler = new RaiseExceptionErrorHandler();

// Build a manager
optimizelyManager = OptimizelyManager.builder()
  .withSDKKey("SDK_KEY_HERE")
  .withEventDispatchInterval(60L * 10L)
  .withErrorHandler(errorHandler)
  .withDatafileDownloadInterval(60L * 10L)
  .build(getApplicationContext());