Storage.readJSON possibly not working as documented

Posted on
  • var c = require("Storage").readJSON("myfile.json­",true);
    console.log("type of c is " + typeof(c));
    

    If I am reading the documentation correctly, if myfile.json is mangled, c should be set to undefined, but my app simply dies and never logs anything at all. (If myfile.json doesn't exist, c is set to undefined as expected.) If I change "true" to "false", a syntax error is logged and then the app dies. For the record, myfile.json contained "#0f0" when I discovered the issue, which I am currently working around with try/catch.

  • Ahh - thanks! So just to confirm:

    require("Storage").write("myfile.json","­#0f0");
    var c = require("Storage").readJSON("myfile.json­",true)||"error";print("Got",c);
    

    Doesn't print anything, when it should have printed Got error. It basically stops execution right after readJSON.

    I've just fixed the error, so new builds should have the fix in

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Storage.readJSON possibly not working as documented

Posted by Avatar for skm @skm

Actions