Skip to content

Error Callbacks

Partners can subscribe to be notified of error events that occur within the SDK. The errors returned are specific to failures that partners have control over, such as issues with auth tokens. These events are intended to be used for debugging or analytic purposes, and should not be used to change the user experience as the display of error messaging is handled by the SDK.

Partners should implement the CDLXErrorDelegate protocol to receive the error events from the SDK.

1
2
3
4
5
CDLX.instance?.errorDelegate = self

func errorOccurred(in cdlx: CDLX, error: CDLX) {
    print("Received error from CDLX SDK. Localized description: \(error.localizedDescription) --- failure reason: \(String(describing: error.failureReason))")
}

Partners should implement the CDLXErrorListener interface to receive the error events from the SDK.

1
2
3
4
5
6
7
8
9
PoweredByCDLX.instance?.errorListener = this

override fun onErrorOccurred(exception: CDLXException) {
    if (exception is CDLXException.NetworkError) {
        Log.e("CDLX-ERROR", exception.message, exception.cause)
    } else {
        Log.e("CDLX-ERROR", exception.message ?: "")
    }
}