Skip to main content

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:

FieldTypeDescription
messagestringHuman-readable description of the error.
codeintegerHTTP status code. Present on network request failures.
urlstringThe 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:

messagecodeCause
Session config rejected - <reason>—Invalid or missing config input. No network request was made.
Config Not Found404The siteID/eventID pair has no configuration in the target environment.
Config request failed - <reason>HTTP statusHost 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 rejected errors indicate a problem with the config values your application set — check that siteID, eventID or pageID, authToken, and swid are non-empty strings before setting m.lib.config.
  • Config request failed errors include a url field identifying which endpoint was unreachable.
  • Do not expose message strings directly to end users; use them for internal diagnostics and logging.