Skip to content

Commit e3099eb

Browse files
committed
Merge pull request #554 from getsentry/opera-mini
Parse exception type out of Opera Mini messages (fixes #546)
2 parents d1050ce + f180ee2 commit e3099eb

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

test/vendor/tracekit.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,17 @@ describe('TraceKit', function(){
157157
TraceKit.report.subscribe(subscriptionHandler);
158158
// should work with/without "Uncaught"
159159
window.onerror('Uncaught ReferenceError: foo is undefined', 'http://example.com', testLineNo);
160-
window.onerror('ReferenceError: foo is undefined', 'http://example.com', testLineNo)
160+
window.onerror('ReferenceError: foo is undefined', 'http://example.com', testLineNo);
161+
done();
162+
});
163+
164+
it('should separate name, message for default error types on Opera Mini (see #546)', function (done) {
165+
subscriptionHandler = function (stackInfo, extra) {
166+
assert.equal(stackInfo.name, 'ReferenceError');
167+
assert.equal(stackInfo.message, 'Undefined variable: foo');
168+
};
169+
TraceKit.report.subscribe(subscriptionHandler);
170+
window.onerror('Uncaught exception: ReferenceError: Undefined variable: foo', 'http://example.com', testLineNo);
161171
done();
162172
});
163173

vendor/TraceKit/tracekit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var _slice = [].slice;
2424
var UNKNOWN_FUNCTION = '?';
2525

2626
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
27-
var ERROR_TYPES_RE = /^(?:Uncaught )?((?:Eval|Internal|Range|Reference|Syntax|Type|URI)Error)\: ?(.*)$/;
27+
var ERROR_TYPES_RE = /^(?:Uncaught (?:exception: )?)?((?:Eval|Internal|Range|Reference|Syntax|Type|URI)Error): ?(.*)$/;
2828

2929
function getLocationHref() {
3030
if (typeof document === 'undefined')

0 commit comments

Comments
 (0)