How to get backtrace in javascript?
Ideal features:
- the name of the login function or any meaningful identifier for anonymous functions,
- a list of arguments at each level,
- line numbers.
Can this be done in standard ECMAScript?
If not, can this be done in the general web browser dialog?
Thanks.
Edit -
Thanks for your suggestions.
My dialect does not support arguments.caller or arguments.callee .
I can do it:
try { let x = null; x .foo (); } catch (e) { debug (dump (e.stack)); }
Which gets me information as a string, which is understandable, but it would be very useful to go through e.stack . Does it have a standard shape?
Thanks again.
spraff
source share