Here's a revised version of the debug.getCode snippet of the wrapper. Please copy/paste into your copy of the wrapper (replacing the original getCode function) and let me know if it works for you.
/* -------------------------------------------------------------------------
pipwerks.SCORM.debug.getCode
Requests the error code for the current error state from the LMS
Parameters: None
Returns: Integer (the last error code).
---------------------------------------------------------------------------- */
pipwerks.SCORM.debug.getCode = function(){
var API = pipwerks.SCORM.API.getHandle(),
scorm = pipwerks.SCORM,
trace = pipwerks.UTILS.trace,
code = 0;
if(API){
switch(scorm.version){
case "1.2" : code = API.LMSGetLastError(); break;
case "2004": code = API.GetLastError(); break;
}
//Fix for Saba returning empty string.
//If empty string, assume everything's OK and change code to 0
code = (code === "") ? 0 : parseInt(code, 10);
} else {
trace("SCORM.debug.getCode failed: API is null.");
}
return code;
};
FYI the SCORM documentation doesn't say anything about passing empty strings for error codes... I guess it technically isn't wrong, but the docs say the error code should be "strings that can be converted to integer numbers" (SCORM 1.2) or "a characterstring (convertible to an integer in the range from 0 to 65536 inclusive) representing the error code of the last error encountered" (SCORM 2004).
An empty string can't be converted to an integer.
- philip