Skip to content

Don't additionally pass msg if exception interface set #632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,12 +1062,11 @@ Raven.prototype = {
},

_processException: function(type, message, fileurl, lineno, frames, options) {
var stacktrace, fullMessage;
var stacktrace;

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

message += '';
fullMessage = (type ? type + ': ' : '') + message;

if (frames && frames.length) {
fileurl = frames[0].filename || fileurl;
Expand Down Expand Up @@ -1097,8 +1096,7 @@ Raven.prototype = {
stacktrace: stacktrace
}]
},
culprit: fileurl,
message: fullMessage
culprit: fileurl
}, options);

// Fire away!
Expand Down Expand Up @@ -1220,9 +1218,12 @@ Raven.prototype = {
auth.sentry_secret = this._globalSecret;
}

var exception = data.exception && data.exception.values[0];
this.captureBreadcrumb({
category: 'sentry',
message: data.message,
message: exception
? (exception.type ? exception.type + ': ' : '') + exception.message
: data.message,
event_id: data.event_id,
level: data.level || 'error' // presume error unless specified
});
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('integration', function () {
},
function () {
var ravenData = iframe.contentWindow.ravenData[0];
assert.isTrue(/SyntaxError/.test(ravenData.message)); // full message differs per-browser
assert.isTrue(/SyntaxError/.test(ravenData.exception.values[0].type)); // full message differs per-browser
assert.equal(ravenData.exception.values[0].stacktrace.frames.length, 1); // just one frame
}
);
Expand Down
21 changes: 4 additions & 17 deletions test/raven.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,7 @@ describe('globals', function() {
}
}]
},
culprit: 'http://example.com/file1.js',
message: 'Error: lol'
culprit: 'http://example.com/file1.js'
}]);

Raven._processException('Error', 'lol', '', 10, frames.slice(0), {});
Expand All @@ -497,8 +496,7 @@ describe('globals', function() {
}
}]
},
culprit: 'http://example.com/file1.js',
message: 'Error: lol'
culprit: 'http://example.com/file1.js'
}]);

Raven._processException('Error', 'lol', '', 10, frames.slice(0), {extra: 'awesome'});
Expand All @@ -513,7 +511,6 @@ describe('globals', function() {
}]
},
culprit: 'http://example.com/file1.js',
message: 'Error: lol',
extra: 'awesome'
}]);
});
Expand All @@ -536,8 +533,7 @@ describe('globals', function() {
}
}]
},
culprit: 'http://example.com/override.js',
message: 'Error: lol'
culprit: 'http://example.com/override.js'
}]);

Raven._processException('Error', 'lol', 'http://example.com/override.js', 10, [], {});
Expand All @@ -555,8 +551,7 @@ describe('globals', function() {
}
}]
},
culprit: 'http://example.com/override.js',
message: 'Error: lol'
culprit: 'http://example.com/override.js'
}]);

Raven._processException('Error', 'lol', 'http://example.com/override.js', 10, [], {extra: 'awesome'});
Expand All @@ -575,7 +570,6 @@ describe('globals', function() {
}]
},
culprit: 'http://example.com/override.js',
message: 'Error: lol',
extra: 'awesome'
}]);
});
Expand All @@ -586,13 +580,6 @@ describe('globals', function() {
Raven._processException('TypeError', undefined, 'http://example.com', []);
assert.isTrue(Raven._send.called);
});

it('should omit error name as part of message if error name is undefined/falsy', function () {
this.sinon.stub(Raven, '_send');

Raven._processException(undefined, '\'foo\' is undefined', 'http://example.com', 10); // IE9 ReferenceError
assert.deepEqual(Raven._send.lastCall.args[0].message, '\'foo\' is undefined');
});
});

describe('send', function() {
Expand Down