The following code is attempting to generate a catched error inside the 'inner' function and rethrow it to the 'outer' function so that it is catched again there.
Testing it on JSFiddle does produce the 2 Catch inner and outer to happen, it is not the case on Espruino 1v80.
Am I missing something?
function outer() {
try {
console.log('In outer');
inner();
console.log('Out outer');
} catch(x) {
console.log('Catch outer');
}
}
function inner() {
try {
console.log('In inner');
throw "coucou";
console.log('Out inner');
} catch(x) {
console.log('Catch inner'+x);
throw x;
}
}
>outer();
In outer
In inner
Catch innercoucou
Out outer
=undefined
Uncaught coucou
at line 8 col 10
throw x;
^
>
There are 2 threads on this forum about catch and throw but they did not helped me...
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.
Hello All,
The following code is attempting to generate a catched error inside the 'inner' function and rethrow it to the 'outer' function so that it is catched again there.
Testing it on JSFiddle does produce the 2 Catch inner and outer to happen, it is not the case on Espruino 1v80.
Am I missing something?
There are 2 threads on this forum about catch and throw but they did not helped me...
Thank's for reading.