Espruino/tests/test_exception_7.js
2015-08-26 14:04:10 +01:00

35 lines
476 B
JavaScript

// http://forum.espruino.com/conversations/273386/
var r = "";
function log(s) {
r += s+"\n";
console.log(s);
}
function outer() {
try {
log('In outer');
inner();
log('Out outer');
} catch(x) {
log('Catch outer '+x);
}
}
function inner() {
try {
log('In inner');
throw "coucou";
log('Out inner');
} catch(x) {
log('Catch inner '+x);
throw x;
}
}
outer();
result = r=="In outer\nIn inner\nCatch inner coucou\nCatch outer coucou\n";