simplify-scorm
simplify-scorm copied to clipboard
GetLastError function does not return the right error code
Hi, I noticed a couple issues with GetLastError implementation when I was playing around with this library. Although, let me know if this is intentional and I misunderstood the SCORM spec in some way.
First issue is specific to SCORM 1.2:
- Call Initialize()
- Call SetValue("cmi.core.student_name", "asd") (or any other read only value) -> 403 error as expected
- Call GetLastError() -> error code 0 returned
I believe this is because there is a check missing for lastErrorCode != 0
, which 2004 implementation has, here: https://github.com/gabrieldoty/simplify-scorm/blob/master/src/scormAPI.js#L223C16-L223C16
Second issue happens in both 1.2 and 2004:
- Do NOT call Initialize()
- Call SetValue("cmi.core.student_name", "asd") (or any other value, it doesn't matter) -> 301 error as expected
- Call GetLastError() -> error code 0 returned
I haven't dug around in the code as to why this happens.