Skip to content

Commit 5ad2844

Browse files
committed
Add test verifying that Raven captures custom errors
1 parent 3374c5d commit 5ad2844

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/raven.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,21 @@ describe('Raven (public API)', function() {
20472047
assert.isFalse(Raven._handleStackInfo.called);
20482048
});
20492049

2050+
it('should capture custom errors that extend the Error prototype', function() {
2051+
function NotImplementedError(message) {
2052+
this.name = "NotImplementedError";
2053+
this.message = message || "";
2054+
}
2055+
NotImplementedError.prototype = Error.prototype;
2056+
2057+
this.sinon.stub(Raven, 'isSetup').returns(true);
2058+
this.sinon.stub(Raven, '_handleStackInfo');
2059+
2060+
Raven.captureException(new NotImplementedError('Bzzap'));
2061+
2062+
assert.isTrue(Raven._handleStackInfo.calledOnce);
2063+
});
2064+
20502065
it('should not throw an error if not configured', function() {
20512066
this.sinon.stub(Raven, 'isSetup').returns(false);
20522067
this.sinon.stub(Raven, '_handleStackInfo');

0 commit comments

Comments
 (0)