Skip to content

Commit fbf1d1b

Browse files
authored
Don't additionally pass msg if exception interface set (#632)
1 parent 4291519 commit fbf1d1b

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

src/raven.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,12 +1062,11 @@ Raven.prototype = {
10621062
},
10631063

10641064
_processException: function(type, message, fileurl, lineno, frames, options) {
1065-
var stacktrace, fullMessage;
1065+
var stacktrace;
10661066

10671067
if (!!this._globalOptions.ignoreErrors.test && this._globalOptions.ignoreErrors.test(message)) return;
10681068

10691069
message += '';
1070-
fullMessage = (type ? type + ': ' : '') + message;
10711070

10721071
if (frames && frames.length) {
10731072
fileurl = frames[0].filename || fileurl;
@@ -1097,8 +1096,7 @@ Raven.prototype = {
10971096
stacktrace: stacktrace
10981097
}]
10991098
},
1100-
culprit: fileurl,
1101-
message: fullMessage
1099+
culprit: fileurl
11021100
}, options);
11031101

11041102
// Fire away!
@@ -1220,9 +1218,12 @@ Raven.prototype = {
12201218
auth.sentry_secret = this._globalSecret;
12211219
}
12221220

1221+
var exception = data.exception && data.exception.values[0];
12231222
this.captureBreadcrumb({
12241223
category: 'sentry',
1225-
message: data.message,
1224+
message: exception
1225+
? (exception.type ? exception.type + ': ' : '') + exception.message
1226+
: data.message,
12261227
event_id: data.event_id,
12271228
level: data.level || 'error' // presume error unless specified
12281229
});

test/integration/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('integration', function () {
9191
},
9292
function () {
9393
var ravenData = iframe.contentWindow.ravenData[0];
94-
assert.isTrue(/SyntaxError/.test(ravenData.message)); // full message differs per-browser
94+
assert.isTrue(/SyntaxError/.test(ravenData.exception.values[0].type)); // full message differs per-browser
9595
assert.equal(ravenData.exception.values[0].stacktrace.frames.length, 1); // just one frame
9696
}
9797
);

test/raven.test.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,7 @@ describe('globals', function() {
482482
}
483483
}]
484484
},
485-
culprit: 'http://example.com/file1.js',
486-
message: 'Error: lol'
485+
culprit: 'http://example.com/file1.js'
487486
}]);
488487

489488
Raven._processException('Error', 'lol', '', 10, frames.slice(0), {});
@@ -497,8 +496,7 @@ describe('globals', function() {
497496
}
498497
}]
499498
},
500-
culprit: 'http://example.com/file1.js',
501-
message: 'Error: lol'
499+
culprit: 'http://example.com/file1.js'
502500
}]);
503501

504502
Raven._processException('Error', 'lol', '', 10, frames.slice(0), {extra: 'awesome'});
@@ -513,7 +511,6 @@ describe('globals', function() {
513511
}]
514512
},
515513
culprit: 'http://example.com/file1.js',
516-
message: 'Error: lol',
517514
extra: 'awesome'
518515
}]);
519516
});
@@ -536,8 +533,7 @@ describe('globals', function() {
536533
}
537534
}]
538535
},
539-
culprit: 'http://example.com/override.js',
540-
message: 'Error: lol'
536+
culprit: 'http://example.com/override.js'
541537
}]);
542538

543539
Raven._processException('Error', 'lol', 'http://example.com/override.js', 10, [], {});
@@ -555,8 +551,7 @@ describe('globals', function() {
555551
}
556552
}]
557553
},
558-
culprit: 'http://example.com/override.js',
559-
message: 'Error: lol'
554+
culprit: 'http://example.com/override.js'
560555
}]);
561556

562557
Raven._processException('Error', 'lol', 'http://example.com/override.js', 10, [], {extra: 'awesome'});
@@ -575,7 +570,6 @@ describe('globals', function() {
575570
}]
576571
},
577572
culprit: 'http://example.com/override.js',
578-
message: 'Error: lol',
579573
extra: 'awesome'
580574
}]);
581575
});
@@ -586,13 +580,6 @@ describe('globals', function() {
586580
Raven._processException('TypeError', undefined, 'http://example.com', []);
587581
assert.isTrue(Raven._send.called);
588582
});
589-
590-
it('should omit error name as part of message if error name is undefined/falsy', function () {
591-
this.sinon.stub(Raven, '_send');
592-
593-
Raven._processException(undefined, '\'foo\' is undefined', 'http://example.com', 10); // IE9 ReferenceError
594-
assert.deepEqual(Raven._send.lastCall.args[0].message, '\'foo\' is undefined');
595-
});
596583
});
597584

598585
describe('send', function() {

0 commit comments

Comments
 (0)