Skip to content

Commit

Permalink
1.1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrobenolt committed Jul 26, 2014
1 parent 6539718 commit 2cf8531
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 21 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "raven-js",
"version": "1.1.15",
"version": "1.1.16",
"dependencies": {},
"main": "dist/raven.js"
}
71 changes: 57 additions & 14 deletions dist/raven.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Raven.js 1.1.15 (bc060ae) | github.com/getsentry/raven-js */
/*! Raven.js 1.1.16 (463f68f) | github.com/getsentry/raven-js */

/*
* Includes TraceKit
Expand Down Expand Up @@ -645,8 +645,8 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
return null;
}

var chrome = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?((?:file|https?):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|https?).*?):(\d+)(?::(\d+))?\s*$/i,
var chrome = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?((?:file|https?|chrome-extension):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|https?|chrome).*?):(\d+)(?::(\d+))?\s*$/i,
lines = ex.stack.split('\n'),
stack = [],
parts,
Expand Down Expand Up @@ -1108,15 +1108,18 @@ var _Raven = window.Raven,
tags: {},
extra: {}
},
authQueryString;
authQueryString,
isRavenInstalled = false;

/*
* The core Raven singleton
*
* @this {Raven}
*/
var Raven = {
VERSION: '1.1.15',
VERSION: '1.1.16',

debug: true,

/*
* Allow multiple versions of Raven to be installed.
Expand All @@ -1137,6 +1140,10 @@ var Raven = {
* @return {Raven}
*/
config: function(dsn, options) {
if (globalServer) {
logDebug('error', 'Error: Raven has already been configured');
return Raven;
}
if (!dsn) return Raven;

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

// Other variants of external script errors:
globalOptions.ignoreErrors.push('Javascript error: Script error on line 0');
globalOptions.ignoreErrors.push('Javascript error: Script error. on line 0');

// join regexp rules into one big rule
globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);
globalOptions.ignoreUrls = globalOptions.ignoreUrls.length ? joinRegExp(globalOptions.ignoreUrls) : false;
Expand Down Expand Up @@ -1198,8 +1209,9 @@ var Raven = {
* @return {Raven}
*/
install: function() {
if (isSetup()) {
if (isSetup() && !isRavenInstalled) {
TraceKit.report.subscribe(handleStackInfo);
isRavenInstalled = true;
}

return Raven;
Expand Down Expand Up @@ -1273,7 +1285,7 @@ var Raven = {

// copy over properties of the old function
for (var property in func) {
if (func.hasOwnProperty(property)) {
if (hasKey(func, property)) {
wrapped[property] = func[property];
}
}
Expand All @@ -1293,6 +1305,7 @@ var Raven = {
*/
uninstall: function() {
TraceKit.report.uninstall();
isRavenInstalled = false;

return Raven;
},
Expand Down Expand Up @@ -1351,12 +1364,36 @@ var Raven = {
* @param {object} user An object representing user data [optional]
* @return {Raven}
*/
setUser: function(user) {
setUserContext: function(user) {
globalUser = user;

return Raven;
},

/*
* Set extra attributes to be sent along with the payload.
*
* @param {object} extra An object representing extra data [optional]
* @return {Raven}
*/
setExtraContext: function(extra) {
globalOptions.extra = extra || {};

return Raven;
},

/*
* Set tags to be sent along with the payload.
*
* @param {object} tags An object representing tags [optional]
* @return {Raven}
*/
setTagsContext: function(tags) {
globalOptions.tags = tags || {};

return Raven;
},

/*
* Get the latest raw exception that was captured by Raven.
*
Expand All @@ -1376,6 +1413,8 @@ var Raven = {
}
};

Raven.setUser = Raven.setUserContext; // To be deprecated

function triggerEvent(eventType, options) {
var event, key;

Expand All @@ -1391,7 +1430,7 @@ function triggerEvent(eventType, options) {
event.eventType = eventType;
}

for (key in options) if (options.hasOwnProperty(key)) {
for (key in options) if (hasKey(options, key)) {
event[key] = options[key];
}

Expand Down Expand Up @@ -1468,7 +1507,7 @@ function each(obj, callback) {

if (isUndefined(obj.length)) {
for (i in obj) {
if (obj.hasOwnProperty(i)) {
if (hasKey(obj, i)) {
callback.call(null, i, obj[i]);
}
}
Expand Down Expand Up @@ -1541,7 +1580,7 @@ function normalizeFrame(frame) {
// Now we check for fun, if the function name is Raven or TraceKit
/(Raven|TraceKit)\./.test(normalized['function']) ||
// finally, we do a last ditch effort and check for raven.min.js
/raven\.(min\.)js$/.test(normalized.filename)
/raven\.(min\.)?js$/.test(normalized.filename)
);

return normalized;
Expand Down Expand Up @@ -1736,9 +1775,7 @@ function makeRequest(data) {
function isSetup() {
if (!hasJSON) return false; // needs JSON support
if (!globalServer) {
if (window.console && console.error) {
console.error("Error: Raven has not been configured.");
}
logDebug('error', 'Error: Raven has not been configured.');
return false;
}
return true;
Expand Down Expand Up @@ -1775,6 +1812,12 @@ function uuid4() {
});
}

function logDebug(level, message) {
if (window.console && console[level] && Raven.debug) {
console[level](message);
}
}

function afterLoad() {
// Attempt to initialize Raven on load
var RavenConfig = window.RavenConfig;
Expand Down
4 changes: 2 additions & 2 deletions dist/raven.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/raven.min.map

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions docs/changelog/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Changelog
=========

1.1.16
~~~~~~
* Fixed a bug that was preventing stack frames from ``raven.js`` from being hidden correctly. See: https://github.com/getsentry/raven-js/pull/216
* Fixed an IE bug with the ``console`` plugin. See: https://github.com/getsentry/raven-js/issues/217
* Added support for ``chrome-extension://`` protocol in Chrome in stack traces.
* Added ``setExtraContext`` and ``setTagsContext``. See: https://github.com/getsentry/raven-js/pull/219
* Renamed ``setUser`` to ``setUserContext`` to match. ``setUser`` still exists, but will be deprecated in a future release.
* New ``backbone.js`` plugin. See: https://github.com/getsentry/raven-js/pull/220
* Added support for ``chrome://`` protocol in Firefox in stack traces. See: https://github.com/getsentry/raven-js/pull/225
* Ignore more garbage from IE cross origin errors. See: https://github.com/getsentry/raven-js/pull/224
* 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
* Prevent calling ``Raven.config()`` or ``Raven.install()`` twice. See: https://github.com/getsentry/raven-js/pull/233

1.1.15
~~~~~~
* Fix issues if a non-string were passed to ``Raven.captureMessage`` and non-Error objects were passed to ``Raven.captureException``.
Expand Down
12 changes: 10 additions & 2 deletions docs/usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ While a user is logged in, you can tell Sentry to associate errors with user dat

.. code-block:: javascript
Raven.setUser({
Raven.setUserContext({
email: 'matt@example.com',
id: '123'
})
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.*
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.*

Capturing a specific message
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -89,6 +89,14 @@ Passing additional data
Raven.captureException(e, {extra: { foo: "bar" }})
You can also set context variables globally to be merged in with future exceptions with ``setExtraContext`` and ``setTagsContext``.

.. code-block:: javascript
Raven.setExtraContext({ foo: "bar" })
Raven.setTagsContext({ key: "value" })
Getting back an event id
~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "raven",
"version": "1.1.15",
"version": "1.1.16",
"scripts": {
"test": "./node_modules/.bin/grunt test"
},
Expand Down

0 comments on commit 2cf8531

Please sign in to comment.