simplify-scorm icon indicating copy to clipboard operation
simplify-scorm copied to clipboard

GetLastError function does not return the right error code

Open mbabayev-coursera opened this issue 1 year ago • 0 comments

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:

  1. Call Initialize()
  2. Call SetValue("cmi.core.student_name", "asd") (or any other read only value) -> 403 error as expected
  3. 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:

  1. Do NOT call Initialize()
  2. Call SetValue("cmi.core.student_name", "asd") (or any other value, it doesn't matter) -> 301 error as expected
  3. Call GetLastError() -> error code 0 returned

I haven't dug around in the code as to why this happens.

mbabayev-coursera avatar Oct 16 '23 16:10 mbabayev-coursera