On Fri, May 20, 2016 at 4:35 AM, Rasmus Schultz <[email protected]> wrote:
> This is inconsistent with at least JavaScript and C#, where the stack
> trace is populated at the throw site. (Probably others?)
>
I'm not sure about C#, but in JavaScript (Node.js):
function get_error() {
return new Error('my error');
}
function do_throw(e) {
throw e;
}
try {
do_throw(get_error());
} catch (e) {
console.log(e.stack);
}
results in:
Error: my error
at get_error (/home/jesse/src/test.js:2:12)
at Object.<anonymous> (/home/jesse/src/test.js:10:14)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:146:18)
at node.js:404:3
The top frame is the construction (get_error) and the site of the throw
(do_throw) doesn't appear in the stack at all.