Skip to content

Common output format #21

Closed
Nitrogenycs opened this Issue May 10, 2011 · 19 comments
@Nitrogenycs

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

0: "Object.run (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 }

@eriwen
stacktrace.js member
eriwen commented May 17, 2011

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

@eriwen eriwen was assigned May 17, 2011
@eriwen
stacktrace.js member
eriwen commented Nov 1, 2011

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.

@JamesMGreene

Subscribe

@champo
champo commented Oct 2, 2012

Are there any plans to implement this?

@eriwen
stacktrace.js member
eriwen commented Oct 3, 2012

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

@joshuap
joshuap commented Dec 19, 2012

👍 this would be sweet :)

@alexstrat

What's the state of this ?

@kmontag
kmontag commented Jan 11, 2013

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

@eriwen
stacktrace.js member
eriwen commented Jan 16, 2013

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 (https://github.com/eriwen/javascript-stacktrace/tree/api-spike) 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.

Cheers,
Eric

@victor-homyakov

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).

@eriwen
stacktrace.js member
eriwen commented Jan 18, 2013

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

@fresheneesz

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

@fresheneesz

@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: https://github.com/fresheneesz/stackinfo . Would love help testing it, or advise as to how to go about doing that effectively.

@niemyjski

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 :..

@bountin
bountin commented Aug 29, 2014

Any updates on this issue?

@eriwen
stacktrace.js member
eriwen commented Aug 29, 2014

@bountin Being worked on for v1.0 - http://git.io/stack-parser

@fresheneesz

@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.

@eriwen
stacktrace.js member
eriwen commented Aug 29, 2014

@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 me@eriwen.com and we can see how we might work together toward a common goal

@eriwen eriwen modified the milestone: 1.0, 0.9 Sep 1, 2014
@eriwen
stacktrace.js member
eriwen commented Oct 7, 2014

New common format for 1.0: https://github.com/stacktracejs/stackframe

@eriwen eriwen closed this Oct 7, 2014
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.