Skip to content

Commit 11df110

Browse files
Merge pull request #166 from benjamingr/patch-1
remove explicit construction
2 parents b4077c1 + 6b8efd4 commit 11df110

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

stacktrace.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,15 @@
8080
fromError: function StackTrace$$fromError(error, opts) {
8181
opts = _merge(_options, opts);
8282
var gps = new StackTraceGPS(opts);
83-
return new Promise(function(resolve) {
84-
var stackframes = ErrorStackParser.parse(error);
85-
if (typeof opts.filter === 'function') {
86-
stackframes = stackframes.filter(opts.filter);
87-
}
88-
resolve(Promise.all(stackframes.map(function(sf) {
89-
return new Promise(function(resolve) {
90-
function resolveOriginal() {
91-
resolve(sf);
92-
}
93-
94-
gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal);
95-
});
96-
})));
97-
}.bind(this));
83+
var stackframes = ErrorStackParser.parse(error);
84+
if (typeof opts.filter === 'function') {
85+
stackframes = stackframes.filter(opts.filter);
86+
}
87+
return Promise.all(stackframes.map(function(sf) {
88+
return gps.pinpoint(sf);
89+
}).catch(function(error) {
90+
return sf;
91+
}));
9892
},
9993

10094
/**

0 commit comments

Comments
 (0)