I am interested in tracking javascript errors and reporting errors with a call.
I am not interested in wrapping everything in try-catch blocks.
According to this article http://blog.errorception.com/2011/12/call-stacks-in-ie.html it is possible inside window.onerror to recursively call .caller for each function on the stack to find out the previous function on the stack "
I tried to get the column:
window.onerror = function(errorMsg, url, lineNumber) { var stk = [], clr = arguments.callee.caller; while(clr) { stk.push("" + clr); clr = clr.caller; }
but only one step is possible, even if the column was much longer:
(function() { function inside() {it.will.be.exception;}; function middle() {inside()}; function outside() {middle()} outside(); })();
One step is not interesting, because the onerror arguments give me even more information about this.
Yes, I tried using IE in accordance with the article mentioned above.
Note. I also tried to open an "ERRORCAEPTION" account to collect the error log. I tested it with IE and "ERRORCAEPTION" realized that the errors came from IE, but I canβt find the call information in the log I have.
source share