Skip to content

Commit 4d1e6d5

Browse files
committed
Allow specifying a custom culprit
1 parent 75858be commit 4d1e6d5

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/parsers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports.parseError = function parseError(err, kwargs, cb) {
3737

3838
for (var n = frames.length - 1; n >= 0; n--) {
3939
if (frames[n].in_app) {
40-
kwargs.culprit = utils.getCulprit(frames[n]);
40+
kwargs.culprit = kwargs.culprit || utils.getCulprit(frames[n]);
4141
break;
4242
}
4343
}

test/raven.parsers.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,17 @@ describe('raven.parsers', function(){
406406
}
407407
});
408408

409+
it('should allow specifying a custom `culprit`', function(done){
410+
try {
411+
throw new Error('Foobar');
412+
} catch(e) {
413+
raven.parsers.parseError(e, { culprit:'foobar' }, function(parsed){
414+
parsed.culprit.should.equal('foobar');
415+
done();
416+
});
417+
}
418+
});
419+
409420
it('should have a string stack after parsing', function(done){
410421
try {
411422
throw new Error('Derp');

0 commit comments

Comments
 (0)