The SCORM 1.2 Runtime Environment (RTE) uses a system of error codes that are set by the API, and which can be read by the SCO using three API functions:
I’ve already implemented “stubs” for these functions in my api.php code as noted in Step 10 – Other SCORM API Fuctions. But, before I make these functions active, I need to set up the error codes and related messages in the API code.
var errorMessages = new Object(); errorMessages['0'] = 'No Error'; errorMessages['101'] = 'General Exception'; errorMessages['201'] = 'Invalid Argument'; errorMessages['202'] = 'Element Cannot Have Children'; errorMessages['203'] = 'Element Not an Array - Cannot Have Children'; errorMessages['301'] = 'API Not Initialized'; errorMessages['401'] = 'Data Model Element Not Implemented'; errorMessages['402'] = 'Invalid Set Value - Element is a Keyword'; errorMessages['403'] = 'Invalid Set Value - Element is Read Only'; errorMessages['404'] = 'Invalid Get Value - Element is Write Only'; errorMessages['405'] = 'Invalid Set Value - Incorrect Data Type';
Why am I using strings e.g. ‘201’ rather than numbers as indices? Because it’s one of the (many) idiosyncrasies of the SCORM standard!
Next time, setting and storing the error code.