problem
I want to have access to the call stack via the non-standard [Error.prototype.stack](
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack) property. While non-standard, it is available in most browsers and in node.js as well.
The primary reason for this ticket is that the absence of this property implemented for all platforms causes vague error output with ti-mocha, or any unit testing library that relies on
Error.prototype.stack
for its stack trace, which is most of them. Aside from this, though, it would just make debugging, testing, and customized error output so much easier.
test case
function foo() {
function bar() {
console.log(new Error().stack);
}
bar();
}
foo();
expected
In the above test case, I would expect that the complete stack trace would be printed to the console. For example, in node.js, the exact same code would result in the following:
≫ node test.js
Error
at bar (/Users/tlukasavage/development/ti-stack/test.js:3:15)
at foo (/Users/tlukasavage/development/ti-stack/test.js:5:2)
at Object.<anonymous> (/Users/tlukasavage/development/ti-stack/test.js:7:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
actual
The output is
null
on iOS and Android. I have no tested our other supported platforms.
Does this relate to the two linked issues? Can we just hook those up here?
I'm not certain, those linked issues don't seem to be the exact same thing. Mine is basically asking for this to be implemented: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack While it is cited as non-standard, it is implemented in node.js and is exceedingly helpful.