Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix the omitting frames issue

  • Loading branch information...
commit c667c66765a5d281bcf224aca3342257ad768dba 1 parent 0dbac53
@chrisdickinson authored
Showing with 7 additions and 13 deletions.
  1. +1 −1  package.json
  2. +6 −12 trace.js
View
2  package.json
@@ -2,7 +2,7 @@
"author": "Chris Dickinson <chris@neversaw.us> (http://neversaw.us/)",
"name": "tracejs",
"description": "Expand Error.stack traces into usable objects providing context and highlighting",
- "version": "0.0.2",
+ "version": "0.0.333",
"homepage": "http://github.com/chrisdickinson/tracejs/",
"repository": {
"type": "git",
View
18 trace.js
@@ -113,27 +113,21 @@ var trace = function(err) {
var lines = err.stack.split('\n'),
first = lines[0],
- stack = lines.slice(1).join('\n');
+ stack = lines.slice(1);
- var frames = [],
+ var frames,
match1, match2;
- do {
+ frames = stack.map(function(line) {
match1 = err_re1(stack);
match2 = err_re2(stack);
if(match1) {
- frames.push(
- new Frame(match1[1], match1[2], parseInt(match1[3], 10), parseInt(match1[4], 10))
- );
- stack = stack.slice(match1.index + match1[0].length);
+ return new Frame(match1[1], match1[2], parseInt(match1[3], 10), parseInt(match1[4], 10))
} else if(match2) {
- frames.push(
- new Frame('<anonymous>', match2[1], parseInt(match2[2], 10), parseInt(match2[3], 10))
- );
- stack = stack.slice(match2.index + match2[0].length);
+ return new Frame('<anonymous>', match2[1], parseInt(match2[2], 10), parseInt(match2[3], 10))
}
- } while(stack.length);
+ });
return new Trace(first, frames, err);
};
Please sign in to comment.
Something went wrong with that request. Please try again.