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.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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.