GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

Error Documentation - Android

BlazeSDK provides structured and consistent error information through the BlazeResult.Error type. Errors can be delivered globally via the SDK delegate, locally via method completion handlers, or via source delegates for widgets, entryPoints, etc., depending on the context.

Error Structure

The BlazeResult.Error data class represents the public-facing error structure returned by the Blaze SDK.

data class Error(
    val statusCode: Int,
    val domain: ErrorDomain,
    val reason: ErrorReason,
    val message: String,
    val metadata: Map<String, String>,
    val cause: Throwable?
)
  • statusCode Optional HTTP or custom status code.
  • domain The domain or category of the error.
  • reason The specific reason for the error.
  • message Human-readable error message.
  • metadata Additional metadata related to the error.
  • cause The underlying exception that caused the error, if any.

Error Delivery Mechanisms

1. BlazeSDKDelegate

Errors marked as 'Thrown to Global Delegate' in the table below are automatically forwarded to your BlazeSDKDelegate implementation via the onErrorThrown callback.

// Example of handling error via BlazeSDKDelegate
private fun createBlazeSDKGlobalDelegate(): BlazeSDKDelegate {
    return object : BlazeSDKDelegate {
        override fun onEventTriggered(eventData: BlazeEventData) {
            onGlobalEventTriggered(eventData)
        }
        
        override fun onErrorThrown(error: BlazeResult.Error) {
            onGlobalErrorThrown(error)
        }
    }
}

private fun onGlobalErrorThrown(error: BlazeResult.Error) {
    // Handle specific error domains and reasons
    when (error.domain) {
        ErrorDomain.INITIALIZATION -> {
            handleInitializationError(error)
        }
        ErrorDomain.WIDGET -> {
            handleWidgetError(error)
        }
        else -> {
            // Handle other domains
        }
    }
}

2. Completion Handlers

Some errors are returned only through completion handlers for specific API calls (e.g., initialization, setting user ID, universal link processing). Therefore, in these cases, you should handle errors exclusively in the callback, as this is the only way to properly catch and respond to them.

// Error should be handled via completion callback
BlazeSDK.init(
  	apiKey =  "your-api-key",
  	completionBlock = {
      	Log.d("Application", "BlazeSDK.init success completionBlock..")
    },
  	errorBlock = { error ->
      	Log.e("Application", "BlazeSDK.init: errorBlock: Init Error = $error")
	      when (error.reason) {
            ErrorReason.INVALID_API_KEY ->  {
                Log.e("Application", "BlazeSDK.init: errorBlock: Invalid API Key")
            }
            ErrorReason.SDK_ALREADY_INITIALIZED -> {
                Log.e("Application", "BlazeSDK.init: errorBlock: SDK Already Initialized")
            }
            else -> {} // Handle other error reasons as needed
        }

    },
)

3. Source Delegates

Component-specific errors are delivered via source delegate onDataLoadComplete handlers for widgets, containers, and entry points:

  • BlazeWidgetDelegate → Widget load errors via onDataLoadComplete handler
  • BlazePlayerInContainerDelegate → Container load errors via onDataLoadComplete handler
  • BlazePlayerInInlineDelegate → Inline player load errors via onDataLoadComplete handler
  • BlazePlayerEntryPointDelegate → Entry point load errors via onDataLoadComplete handler
val widgetDelegate: BlazeWidgetDelegate = object : BlazeWidgetDelegate {

    override fun onDataLoadStarted(playerType: BlazePlayerType, sourceId: String?) {
			// handle onDataLoadStarted
    }

    override fun onDataLoadComplete(
        playerType: BlazePlayerType,
        sourceId: String?,
        itemsCount: Int,
        result: BlazeResult<Unit>
    ) {
        when (result) {
            is BlazeResult.Success -> {
                // Handle successful load
            }
            is BlazeResult.Error -> {
                handleWidgetError(result)
            }
        }
    }
}

Notes

  • All errors marked with ✅ Yes are forwarded to the global delegate.

Error Codes

Initialization Errors (1100–1199)

CodeDomainReasonThrown to Global Delegate
1100INITIALIZATIONINVALID_API_KEY❌ No
1101INITIALIZATIONNETWORK_FAILURE❌ No
1102INITIALIZATIONSDK_ALREADY_INITIALIZED❌ No
1103INITIALIZATIONAPPLICATION_NOT_INITIALIZED❌ No
1104INITIALIZATIONINVALID_GEO_RESTRICTION_CODE❌ No
1105INITIALIZATIONNO_INTERNET_CONNECTION❌ No
1106INITIALIZATIONINVALID_APP_CONFIG❌ No
1107INITIALIZATIONINITIALIZATION_TIME_OUT❌ No

Content Preparation Errors (1200–1299)

CodeDomainReasonThrown to Global Delegate
1200CONTENT_PREPARATIONILLEGAL_PREPARE_ON_DATA_SOURCE_TYPE❌ No

Widget Errors (1300–1399)

CodeDomainReasonThrown to Global Delegate
1300WIDGETNO_AVAILABLE_CONTENT_FOR_DATA_SOURCE❌ No
1301WIDGETINVALID_DATA_SOURCE_TYPE_PROVIDED❌ No
1302WIDGETFAILED_FETCHING_CONTENT❌ No

Entry Point Errors (1400–1499)

CodeDomainReasonThrown to Global Delegate
1400ENTRY_POINTNO_AVAILABLE_CONTENT_FOR_DATA_SOURCE❌ No
1401ENTRY_POINTINVALID_DATA_SOURCE_TYPE_PROVIDED❌ No
1402ENTRY_POINTFAILED_FETCHING_CONTENT❌ No
1403ENTRY_POINTFAILED_PLAYING_STORY❌ No
1404ENTRY_POINTFAILED_PLAYING_MOMENT❌ No
1405ENTRY_POINTFAILED_PLAYING_VIDEO❌ No

Player Errors (1500–1599)

CodeDomainReasonThrown to Global Delegate
1505PLAYERNO_INTERNET_CONNECTION✅ Yes
1506PLAYEREXPIRED_ASSET✅ Yes
1507PLAYERFAILED_TO_LOAD_IMAGE_ASSET✅ Yes
1508PLAYERFAILED_TO_LOAD_VIDEO_ASSET✅ Yes

User Management Errors (1600–1699)

CodeDomainReasonThrown to Global Delegate
1609USER_MANAGEMENTFAILED_TO_SET_EXTERNAL_USER_ID❌ No

Universal Link Errors (1700–1799)

CodeDomainReasonThrown to Global Delegate
1700UNIVERSAL_LINKINVALID_LINK❌ No
1701UNIVERSAL_LINKINVALID_DOMAIN❌ No
1702UNIVERSAL_LINKFAILED_HANDLING_UNIVERSAL_LINK❌ No

Push Notification Errors (1800–1899)

CodeDomainReasonThrown to Global Delegate
1800PUSHINVALID_NOTIFICATION_EXTRAS_SCHEME❌ No
1801PUSHINVALID_NOTIFICATION_BODY_SCHEME❌ No

Container Errors (1900–1999)

CodeDomainReasonThrown to Global Delegate
1900CONTAINERFAILED_PLAYING_CONTENT_CONTAINER❌ No
1901CONTAINERINVALID_DATA_SOURCE_TYPE_PROVIDED❌ No
1902CONTAINERLIFECYCLE_OWNER_NOT_PROVIDED❌ No
1903CONTAINERVIEW_MODEL_STORE_OWNER_NOT_PROVIDED❌ No
1904CONTAINERCONTENT_PREPARATION_FAILED❌ No
1905CONTAINERILLEGAL_PREPARE_ON_DATA_SOURCE_TYPE❌ No
1906CONTAINERFAILED_ADDING_PLACEHOLDER_CONTAINER❌ No

Sharing Errors (2100–2199)

CodeDomainReasonThrown to Global Delegate
2100SHARINGFAILED_LAUNCHING_SHARE_INTENT✅ Yes
2101SHARINGFAILED_CREATING_LINK✅ Yes

Container Tabs Errors (2200-2299)

CodeDomainReasonThrown to Global Delegate
2200CONTAINER_TABSDUPLICATE_CONTAINER_ID✅ Yes

Did this page help you?