• 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?

    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...

    Thank's for reading.

About

Avatar for asez73 @asez73 started