Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Common output format #21

Nitrogenycs opened this Issue · 19 comments

Right now the different browsers return the individual entries in a different format, e.g. chrome it looks like

0: " (http://localhost:8080/resources/app.core.resources/stacktrace.js:75:14)"
1: "printStackTrace (http://localhost:8080/resources/app.core.resources/stacktrace.js:59:20)"
2: "Object.log (http://localhost:8080/resources/app.log.resources/log.js:96:13)"
3: "http://localhost:8080/resources/app.log.resources/log.js:128:7"

While the same code in firefox looks like

0 "{anonymous}()@http://localhost:8080/resources/app.log.resources/stacktrace.js:70"    
1 "{anonymous}(null)@http://localhost:8080/resources/app.log.resources/stacktrace.js:68"
2 "printStackTrace()@http://localhost:8080/resources/app.log.resources/stacktrace.js:59"
3 "{anonymous}("Logging started")@http://localhost:8080/resources/app.log.resources/log.js:96"  
4 "@http://localhost:8080/resources/app.log.resources/log.js:128"

Opera and other browser look yet different.

It might be useful if stacktrace.js entries would be full objects with members "function", "url", "line", "column". So one line of the above output would look like

entry = { function : 'printStackTrace', url : 'http://localhost:8080/resources/app.log.resources/log.js', line : 96, column: 12 }


Agreed that more structure would be useful. I will schedule this for 0.5. Thanks for your feedback

@eriwen eriwen was assigned

I'm going to move away from String based stacktraces (though I'll keep them around for those that use them) to Object output instead.




Are there any plans to implement this?


@champo Yes, I'm have been working (albeit slowly) on a rewrite of stacktrace.js that will include this.


:+1: this would be sweet :)


What's the state of this ?


+1 for this - @eriwen, any chance you could post your rewrite (however far along it is) in a branch so we can submit PRs?


Sorry guys for being lame and slow on this. The next version of stacktrace.js is going to introduce a more modular architecture, with one part being an Error normalizer. I have pushed a really rough start to the api-spike branch ( which does not include other modules of the new impl as they are not rough-ready yet.

Please look at error-parser.js and the tests and give feedback or submit PRs to it if you like.



Syntax looks a bit strange. De facto when function name starts from capital letter it means constructor, so when I see function StackEntry I'll probably try to use it like var se = new StackEntry() rather than var se = StackEntry(), but in order to work as constructor it should look like

function StackEntry(functionName, srcUrl, lineNumber, charNumber) {
    this.fn = functionName;
    this.args = [];
    this.src = srcUrl;
    this.line = lineNumber;
    this.char = charNumber;

The same applies to ErrorInfo and especially ErrorParser (which is exposed as a global object).


@victor-homyakov Yep. How absent-minded of me. I've also added an idea I had for utilizing Error.prepareStackTrace for V8.


This still isn't in? Whats the status of this? Looks like its been 3 years in the making..


@victor-homyakov I quickly cobbled together a module that creates a list of standard output objects, instead of textual stack traces, because I couldn't wait for this. Here it is: . Would love help testing it, or advise as to how to go about doing that effectively.


We'd really like to use this module but it hasn't seen any updates in a long while and I haven't had time to contribute :..


Any updates on this issue?


@bountin Being worked on for v1.0 -


@bountin @eriwen Does stackinfo not do exactly what you're looking for? I'm a little confused why you're doing work I've already done. I would be happy to merge my work into that project if you want to take it further than I have.


@fresheneesz Sorry, despite your issue on the stack-parser I forgot about stackinfo until a couple days ago. There are a couple things I want to talk with you about regarding stackinfo over email. Could you either provide an email addy for me or email me first and we can see how we might work together toward a common goal

@eriwen eriwen modified the milestone: 1.0, 0.9

New common format for 1.0:

@eriwen eriwen closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.