Skip to main content

customExceptionHandler

Custom error handler for SDK-reported errors.

Overview

The customExceptionHandler property allows you to override the default error handling behavior of the SDK. By default, errors are printed to the console. You can provide a custom handler to integrate with your app's logging or error reporting system.

Syntax

var customExceptionHandler: (e: Throwable?, message: String, fatal: Boolean) -> Unit

Parameters

The handler function receives three parameters:

ParameterTypeDescription
eThrowable?The exception that occurred, or null if no exception
messageStringError message describing what happened
fatalBooleanWhether the error is fatal to SDK operation

Example

// Set up custom error handling
MaestroSDK.customExceptionHandler = { throwable, message, fatal ->
// Log to your error reporting service
if (fatal) {
Crashlytics.logException(throwable ?: Exception(message))
} else {
Log.w("Maestro", message, throwable)
}
}

// Then configure the SDK
val sdk = MaestroSDK.configure(
context = applicationContext,
maestroEventDelegate = this,
params = MaestroSDKParameters(siteId = "your-site-id"),
)

Notes

  • Set this handler before calling configure() to capture all errors
  • The default handler prints errors to the console
  • Fatal errors indicate the SDK may not function properly
  • Non-fatal errors are typically recoverable warnings