registerErrorHandler

fun registerErrorHandler(handler: (accountId: String, Exception) -> Unit)

Registers a handler that receives errors from scheduled collect-and-upload workers.

This is the only way the host app can be notified of failures (e.g. expired access tokens) that occur during background execution. The handler is always called on the main thread.

  • accountId identifies which schedule encountered the error.

  • Authentication failures (HTTP 401/403) are delivered as com.futurae.sdk.ts.error.TSAuthenticationException.

  • The failing schedule is not automatically cancelled — call stopScheduledCollections and re-schedule with fresh credentials if needed.

  • Only one handler can be registered at a time; calling again replaces the previous one.

Parameters

handler

Receives the account ID of the failing schedule and the error.