Skip to content

Commit 2cf8531

Browse files
committed
1.1.16
1 parent 6539718 commit 2cf8531

File tree

7 files changed

+85
-21
lines changed

7 files changed

+85
-21
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "raven-js",
3-
"version": "1.1.15",
3+
"version": "1.1.16",
44
"dependencies": {},
55
"main": "dist/raven.js"
66
}

dist/raven.js

+57-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 1.1.15 (bc060ae) | github.com/getsentry/raven-js */
1+
/*! Raven.js 1.1.16 (463f68f) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit
@@ -645,8 +645,8 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
645645
return null;
646646
}
647647

648-
var chrome = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?((?:file|https?):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
649-
gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|https?).*?):(\d+)(?::(\d+))?\s*$/i,
648+
var chrome = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?((?:file|https?|chrome-extension):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
649+
gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|https?|chrome).*?):(\d+)(?::(\d+))?\s*$/i,
650650
lines = ex.stack.split('\n'),
651651
stack = [],
652652
parts,
@@ -1108,15 +1108,18 @@ var _Raven = window.Raven,
11081108
tags: {},
11091109
extra: {}
11101110
},
1111-
authQueryString;
1111+
authQueryString,
1112+
isRavenInstalled = false;
11121113

11131114
/*
11141115
* The core Raven singleton
11151116
*
11161117
* @this {Raven}
11171118
*/
11181119
var Raven = {
1119-
VERSION: '1.1.15',
1120+
VERSION: '1.1.16',
1121+
1122+
debug: true,
11201123

11211124
/*
11221125
* Allow multiple versions of Raven to be installed.
@@ -1137,6 +1140,10 @@ var Raven = {
11371140
* @return {Raven}
11381141
*/
11391142
config: function(dsn, options) {
1143+
if (globalServer) {
1144+
logDebug('error', 'Error: Raven has already been configured');
1145+
return Raven;
1146+
}
11401147
if (!dsn) return Raven;
11411148

11421149
var uri = parseDSN(dsn),
@@ -1155,6 +1162,10 @@ var Raven = {
11551162
globalOptions.ignoreErrors.push('Script error.');
11561163
globalOptions.ignoreErrors.push('Script error');
11571164

1165+
// Other variants of external script errors:
1166+
globalOptions.ignoreErrors.push('Javascript error: Script error on line 0');
1167+
globalOptions.ignoreErrors.push('Javascript error: Script error. on line 0');
1168+
11581169
// join regexp rules into one big rule
11591170
globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);
11601171
globalOptions.ignoreUrls = globalOptions.ignoreUrls.length ? joinRegExp(globalOptions.ignoreUrls) : false;
@@ -1198,8 +1209,9 @@ var Raven = {
11981209
* @return {Raven}
11991210
*/
12001211
install: function() {
1201-
if (isSetup()) {
1212+
if (isSetup() && !isRavenInstalled) {
12021213
TraceKit.report.subscribe(handleStackInfo);
1214+
isRavenInstalled = true;
12031215
}
12041216

12051217
return Raven;
@@ -1273,7 +1285,7 @@ var Raven = {
12731285

12741286
// copy over properties of the old function
12751287
for (var property in func) {
1276-
if (func.hasOwnProperty(property)) {
1288+
if (hasKey(func, property)) {
12771289
wrapped[property] = func[property];
12781290
}
12791291
}
@@ -1293,6 +1305,7 @@ var Raven = {
12931305
*/
12941306
uninstall: function() {
12951307
TraceKit.report.uninstall();
1308+
isRavenInstalled = false;
12961309

12971310
return Raven;
12981311
},
@@ -1351,12 +1364,36 @@ var Raven = {
13511364
* @param {object} user An object representing user data [optional]
13521365
* @return {Raven}
13531366
*/
1354-
setUser: function(user) {
1367+
setUserContext: function(user) {
13551368
globalUser = user;
13561369

13571370
return Raven;
13581371
},
13591372

1373+
/*
1374+
* Set extra attributes to be sent along with the payload.
1375+
*
1376+
* @param {object} extra An object representing extra data [optional]
1377+
* @return {Raven}
1378+
*/
1379+
setExtraContext: function(extra) {
1380+
globalOptions.extra = extra || {};
1381+
1382+
return Raven;
1383+
},
1384+
1385+
/*
1386+
* Set tags to be sent along with the payload.
1387+
*
1388+
* @param {object} tags An object representing tags [optional]
1389+
* @return {Raven}
1390+
*/
1391+
setTagsContext: function(tags) {
1392+
globalOptions.tags = tags || {};
1393+
1394+
return Raven;
1395+
},
1396+
13601397
/*
13611398
* Get the latest raw exception that was captured by Raven.
13621399
*
@@ -1376,6 +1413,8 @@ var Raven = {
13761413
}
13771414
};
13781415

1416+
Raven.setUser = Raven.setUserContext; // To be deprecated
1417+
13791418
function triggerEvent(eventType, options) {
13801419
var event, key;
13811420

@@ -1391,7 +1430,7 @@ function triggerEvent(eventType, options) {
13911430
event.eventType = eventType;
13921431
}
13931432

1394-
for (key in options) if (options.hasOwnProperty(key)) {
1433+
for (key in options) if (hasKey(options, key)) {
13951434
event[key] = options[key];
13961435
}
13971436

@@ -1468,7 +1507,7 @@ function each(obj, callback) {
14681507

14691508
if (isUndefined(obj.length)) {
14701509
for (i in obj) {
1471-
if (obj.hasOwnProperty(i)) {
1510+
if (hasKey(obj, i)) {
14721511
callback.call(null, i, obj[i]);
14731512
}
14741513
}
@@ -1541,7 +1580,7 @@ function normalizeFrame(frame) {
15411580
// Now we check for fun, if the function name is Raven or TraceKit
15421581
/(Raven|TraceKit)\./.test(normalized['function']) ||
15431582
// finally, we do a last ditch effort and check for raven.min.js
1544-
/raven\.(min\.)js$/.test(normalized.filename)
1583+
/raven\.(min\.)?js$/.test(normalized.filename)
15451584
);
15461585

15471586
return normalized;
@@ -1736,9 +1775,7 @@ function makeRequest(data) {
17361775
function isSetup() {
17371776
if (!hasJSON) return false; // needs JSON support
17381777
if (!globalServer) {
1739-
if (window.console && console.error) {
1740-
console.error("Error: Raven has not been configured.");
1741-
}
1778+
logDebug('error', 'Error: Raven has not been configured.');
17421779
return false;
17431780
}
17441781
return true;
@@ -1775,6 +1812,12 @@ function uuid4() {
17751812
});
17761813
}
17771814

1815+
function logDebug(level, message) {
1816+
if (window.console && console[level] && Raven.debug) {
1817+
console[level](message);
1818+
}
1819+
}
1820+
17781821
function afterLoad() {
17791822
// Attempt to initialize Raven on load
17801823
var RavenConfig = window.RavenConfig;

dist/raven.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/raven.min.map

+1-1
Large diffs are not rendered by default.

docs/changelog/index.rst

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
Changelog
22
=========
33

4+
1.1.16
5+
~~~~~~
6+
* Fixed a bug that was preventing stack frames from ``raven.js`` from being hidden correctly. See: https://github.com/getsentry/raven-js/pull/216
7+
* Fixed an IE bug with the ``console`` plugin. See: https://github.com/getsentry/raven-js/issues/217
8+
* Added support for ``chrome-extension://`` protocol in Chrome in stack traces.
9+
* Added ``setExtraContext`` and ``setTagsContext``. See: https://github.com/getsentry/raven-js/pull/219
10+
* Renamed ``setUser`` to ``setUserContext`` to match. ``setUser`` still exists, but will be deprecated in a future release.
11+
* New ``backbone.js`` plugin. See: https://github.com/getsentry/raven-js/pull/220
12+
* Added support for ``chrome://`` protocol in Firefox in stack traces. See: https://github.com/getsentry/raven-js/pull/225
13+
* Ignore more garbage from IE cross origin errors. See: https://github.com/getsentry/raven-js/pull/224
14+
* Added ``Raven.debug`` to prevent logging to ``console`` when ``false``. Defaults to ``true`` for backwards compatability. See: https://github.com/getsentry/raven-js/pull/229
15+
* Prevent calling ``Raven.config()`` or ``Raven.install()`` twice. See: https://github.com/getsentry/raven-js/pull/233
16+
417
1.1.15
518
~~~~~~
619
* Fix issues if a non-string were passed to ``Raven.captureMessage`` and non-Error objects were passed to ``Raven.captureException``.

docs/usage/index.rst

+10-2
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ While a user is logged in, you can tell Sentry to associate errors with user dat
5858

5959
.. code-block:: javascript
6060
61-
Raven.setUser({
61+
Raven.setUserContext({
6262
6363
id: '123'
6464
})
6565
66-
If at any point, the user becomes unauthenticated, you can call ``Raven.setUser()`` with no arguments to remove their data. *This would only really be useful in a large web app where the user logs in/out without a page reload.*
66+
If at any point, the user becomes unauthenticated, you can call ``Raven.setUserContext()`` with no arguments to remove their data. *This would only really be useful in a large web app where the user logs in/out without a page reload.*
6767

6868
Capturing a specific message
6969
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -89,6 +89,14 @@ Passing additional data
8989
9090
Raven.captureException(e, {extra: { foo: "bar" }})
9191
92+
You can also set context variables globally to be merged in with future exceptions with ``setExtraContext`` and ``setTagsContext``.
93+
94+
.. code-block:: javascript
95+
96+
Raven.setExtraContext({ foo: "bar" })
97+
Raven.setTagsContext({ key: "value" })
98+
99+
92100
Getting back an event id
93101
~~~~~~~~~~~~~~~~~~~~~~~~
94102

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "raven",
3-
"version": "1.1.15",
3+
"version": "1.1.16",
44
"scripts": {
55
"test": "./node_modules/.bin/grunt test"
66
},

0 commit comments

Comments
 (0)