mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
691 B
50 lines
691 B
/*
|
|
* Create Error creation (tracedata)
|
|
*/
|
|
|
|
if (typeof print !== 'function') { print = console.log; }
|
|
|
|
// Avoid tailcalls on purpose to ensure traceback is reasonably long.
|
|
|
|
function fun0() {
|
|
var res = new Error('aiee');
|
|
return res;
|
|
}
|
|
|
|
function fun1() {
|
|
var res = fun0();
|
|
return res;
|
|
}
|
|
|
|
function fun2() {
|
|
var res = fun1();
|
|
return res;
|
|
}
|
|
|
|
function fun3() {
|
|
var res = fun2();
|
|
return res;
|
|
}
|
|
|
|
function fun4() {
|
|
var res = fun3();
|
|
return res;
|
|
}
|
|
|
|
function test() {
|
|
var err;
|
|
var i;
|
|
|
|
for (i = 0; i < 1e6; i++) {
|
|
err = fun4();
|
|
}
|
|
|
|
print(err.stack || err);
|
|
}
|
|
|
|
try {
|
|
test();
|
|
} catch (e) {
|
|
print(e.stack || e);
|
|
throw e;
|
|
}
|
|
|