errorInformation
Description
Observable field for error reporting from the SDK. Monitor this field to handle SDK errors gracefully.
Type
assocArray
Usage
m.lib.observeField("errorInformation", "onErrorInformation")
function onErrorInformation(event as Object)
errorData = event.getData()
print "SDK Error: " + formatJson(errorData)
end function
Data Structure
The error object always includes message. Additional fields are present for specific error types:
| Field | Type | Description |
|---|---|---|
message | string | Human-readable description of the error. |
code | integer | HTTP status code. Present on network request failures. |
url | string | The URL that failed. Present on network request failures. |
Config Error States
When the SDK encounters a configuration problem, it sets errorInformation with one of the following messages:
message | code | Cause |
|---|---|---|
Session config rejected - <reason> | — | Invalid or missing config input. No network request was made. |
Config Not Found | 404 | The siteID/eventID pair has no configuration in the target environment. |
Config request failed - <reason> | HTTP status | Host unreachable, 5xx response, or response that could not be parsed as JSON. Includes url. |
Configuration responded with no panels | — | Config loaded successfully but declares no panels for this event. |
Session config rejected and Config Not Found report immediately. Config request failed reports after the retry sequence (1, 2, 4, 8, and 16 seconds) is exhausted.
Example
sub setupErrorObserver()
m.lib.observeField("errorInformation", "onErrorInformation")
end sub
function onErrorInformation(event as Object)
errorData = event.getData()
if errorData = invalid then return
print "SDK Error: " + errorData.message
if instr(1, errorData.message, "Session config rejected") > 0 then
' Bad config input — check the fields passed in m.lib.config
handleConfigInputError(errorData)
else if errorData?.code = 404 then
' siteID/eventID pair has no configuration in this environment
handleNotFound(errorData)
else if instr(1, errorData.message, "Config request failed") > 0 then
' Network or server error — check errorData.code and errorData.url
handleNetworkError(errorData)
else
handleGenericError(errorData)
end if
end function
Notes
- Always monitor this field for error handling in your integration.
Session config rejectederrors indicate a problem with theconfigvalues your application set — check thatsiteID,eventIDorpageID,authToken, andswidare non-empty strings before settingm.lib.config.Config request failederrors include aurlfield identifying which endpoint was unreachable.- Do not expose
messagestrings directly to end users; use them for internal diagnostics and logging.