process.on('uncaughtException',(err)=>{
console.log('!!!UNCAUGHTEXCEPTION!!!',err);
});
const arr= new Uint32Array([1,2,3,4]);
console.log('-A1-');
if (!!arr.xyz) console.log('-A2-');
console.log('-A3-');
But this
process.on('uncaughtException',(err)=>{
console.log('!!!UNCAUGHTEXCEPTION!!!',err);
});
const arr= new Uint32Array([1,2,3,4]);
console.log('-B1-');
try{
if (!!arr.xyz) console.log('-B2-');
console.log('-B3-');
}
catch(e){
console.log('-B4-',e);
}
console.log('-B5-');
reports some strange error (see 2nd UNCAUGHTEXCEPTION message):
-B1-
!!!UNCAUGHTEXCEPTION!!! Error {
"msg": "Field or method \"xyz\" does not already exist, and can't create it on Uint32Array",
"type": "Error",
"stack": " at line 2 col 12\n if (!!arr.xyz) console.log('-B2-');\n ^\n"
}
!!!UNCAUGHTEXCEPTION!!! SyntaxError {
"msg": "Got catch expected EOF",
"type": "SyntaxError",
"stack": " at line 1 col 1\ncatch(e){\n^\n"
}
-B5-
Maybe another topic relates to this: i think that exceptions got lost without any notice when they occured inside a switch statement. i try to come up with some test code for this, too...
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.
Some more suspicious things...
This behaves as expected:
But this
reports some strange error (see 2nd UNCAUGHTEXCEPTION message):
Maybe another topic relates to this: i think that exceptions got lost without any notice when they occured inside a switch statement. i try to come up with some test code for this, too...