EzDevInfo.com

stacktrace.js

Framework-agnostic, micro-library for getting stack traces in all web browsers stacktrace.js by eriwen

What do the numbers in stacktrace.js correlate to?

I'm using stacktrace.js, and it returns several lines that include the URL followed by two numbers separated by colons. For example:

http://url.com/myscript.js:80:34

What does the 80 and the 34, in this example, correlate to? I can't find documentation on this script's use of the numbers.


Source: (StackOverflow)

What's a good snippet to safely instrument "almost all functions" using stacktrace.js?

stacktrace.js is a micro-library for getting stack traces in all web browsers.

It offers functions instrumentation:

var p = new printStackTrace.implementation();
p.instrumentFunction(this, 'baz', logStackTrace);
function logStackTrace(stack) {
    console.log(stack.join(' -> '));
}
function foo() {
    var a = 1;
    bar();
}
function bar() {
    baz();
}
foo(); //Will log a stacktrace when 'baz()' is called containing 'foo()'!

p.deinstrumentFunction(this, 'baz'); //Remove function instrumentation

What's the best way to "instrument all or almost all functions" in a safe way? Basically I want (say ... in "debug mode") to "auto-catch and log" all stack traces from all functions that are feasible to instrument. What's a good snippet to do this? Which functions should I avoid instrumenting?


Source: (StackOverflow)

Advertisements

AngularJS: serverside logging of clientside errors

I've rewritten a web application using angular. But now i have the problem that it's not as easy as window.onerror = function(...) { ... } to send clientside errors to the server. But this is really helpful to detect errors.

I added a custom exception handler to angular using the following code

    $provide.decorator("$exceptionHandler", function($delegate) {
    return function(exception, cause) {
        $delegate(exception, cause);
        log2server(exception + " (" + cause + ")");
    };
});

But this wont allow me to get the location where the exception came from. Any hints/experience how to tackle this? I would also love a solution which is able to work with http://stacktracejs.com/


Source: (StackOverflow)