Author API Initialization
errorListener()
This function is called when one of the preset Learnosity API errors are thrown.
You would want to define this callback so that you can display your own error message or track the error in your own error reporting systems, for example.
Examples
var callbacks = {
errorListener: function (errorEvent) {
console.log('The callback that is executed when a Learnosity API error occurs.');
console.log(errorEvent);
/* For example, providing invalid security details will throw:
{
"code": 41000,
"msg": "Missing security parameters"
}
*/
},
// ...
};
var authorApp = window.LearnosityAuthor.init(
initializationOptions,
callbacks
);
Arguments
-
error object
Object containing error details.
-
code number
The Learnosity error code returned by the API.
-
message string
Message containing information about the error.
-
status boolean
The error status which will always be
false
, indicating a failed operation. -
timestamp number
Returns time (in milliseconds) when the error occurred.
-
Return value
None (undefined
).