Skip to content

Commit 74c6c03

Browse files
authored
3.3.0 (#662)
1 parent 492f4bf commit 74c6c03

14 files changed

+87
-35
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 3.3.0
4+
* NEW: Can now specify `environment` configuration option. See: https://github.com/getsentry/raven-js/pull/661
5+
* CHANGE: Raven.js now serializes data payload w/ json-stringify-safe to avoid circular references. See: https://github.com/getsentry/raven-js/pull/652
6+
* BUGFIX: Angular 1.x plugin no longer clobbers user-specified `dataCallback`. See: https://github.com/getsentry/raven-js/pull/658
7+
38
## 3.2.1
49
* BUGFIX: Fixed error when manually calling captureException with Error objects w/ maxMessageLength > 0. See: https://github.com/getsentry/raven-js/pull/647
510
* BUGFIX: Fixed TypeScript language declaration file for compatibility w/ Webpack loaders. See: https://github.com/getsentry/raven-js/pull/645

dist/plugins/angular.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.2.1 (bbd229d) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.2.1 (492f4bf) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit
@@ -50,7 +50,7 @@ function angularPlugin(Raven, angular) {
5050
.provider('Raven', RavenProvider)
5151
.config(['$provide', ExceptionHandlerProvider]);
5252

53-
Raven.setDataCallback(function(data) {
53+
Raven.setDataCallback(function(data, original) {
5454
// We only care about mutating an exception
5555
var exception = data.exception;
5656
if (exception) {
@@ -66,6 +66,7 @@ function angularPlugin(Raven, angular) {
6666
data.extra.angularDocs = matches[3].substr(0, 250);
6767
}
6868
}
69+
original && original(data);
6970
});
7071
}
7172

dist/plugins/angular.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugins/angular.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugins/console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.2.1 (bbd229d) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.2.1 (492f4bf) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

dist/plugins/console.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugins/ember.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.2.1 (bbd229d) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.2.1 (492f4bf) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

dist/plugins/ember.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugins/require.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.2.1 (bbd229d) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.2.1 (492f4bf) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

dist/plugins/require.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/raven.js

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.2.1 (bbd229d) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.2.1 (492f4bf) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit
@@ -11,6 +11,35 @@
1111
*/
1212

1313
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Raven = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
14+
exports = module.exports = stringify
15+
exports.getSerialize = serializer
16+
17+
function stringify(obj, replacer, spaces, cycleReplacer) {
18+
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
19+
}
20+
21+
function serializer(replacer, cycleReplacer) {
22+
var stack = [], keys = []
23+
24+
if (cycleReplacer == null) cycleReplacer = function(key, value) {
25+
if (stack[0] === value) return "[Circular ~]"
26+
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
27+
}
28+
29+
return function(key, value) {
30+
if (stack.length > 0) {
31+
var thisPos = stack.indexOf(this)
32+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
33+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
34+
if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value)
35+
}
36+
else stack.push(value)
37+
38+
return replacer == null ? value : replacer.call(this, key, value)
39+
}
40+
}
41+
42+
},{}],2:[function(_dereq_,module,exports){
1443
'use strict';
1544

1645
function RavenConfigError(message) {
@@ -22,7 +51,7 @@ RavenConfigError.prototype.constructor = RavenConfigError;
2251

2352
module.exports = RavenConfigError;
2453

25-
},{}],2:[function(_dereq_,module,exports){
54+
},{}],3:[function(_dereq_,module,exports){
2655
'use strict';
2756

2857
var wrapMethod = function(console, level, callback) {
@@ -61,13 +90,14 @@ module.exports = {
6190
wrapMethod: wrapMethod
6291
};
6392

64-
},{}],3:[function(_dereq_,module,exports){
93+
},{}],4:[function(_dereq_,module,exports){
6594
/*global XDomainRequest:false*/
6695
'use strict';
6796

68-
var TraceKit = _dereq_(6);
69-
var RavenConfigError = _dereq_(1);
70-
var utils = _dereq_(5);
97+
var TraceKit = _dereq_(7);
98+
var RavenConfigError = _dereq_(2);
99+
var utils = _dereq_(6);
100+
var stringify = _dereq_(1);
71101

72102
var isFunction = utils.isFunction;
73103
var isUndefined = utils.isUndefined;
@@ -84,7 +114,7 @@ var htmlTreeAsString = utils.htmlTreeAsString;
84114
var parseUrl = utils.parseUrl;
85115
var isString = utils.isString;
86116

87-
var wrapConsoleMethod = _dereq_(2).wrapMethod;
117+
var wrapConsoleMethod = _dereq_(3).wrapMethod;
88118

89119
var dsnKeys = 'source protocol user pass host port path'.split(' '),
90120
dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;
@@ -492,7 +522,20 @@ Raven.prototype = {
492522
*/
493523
getContext: function() {
494524
// lol javascript
495-
return JSON.parse(JSON.stringify(this._globalContext));
525+
return JSON.parse(stringify(this._globalContext));
526+
},
527+
528+
529+
/*
530+
* Set environment of application
531+
*
532+
* @param {string} environment Typically something like 'production'.
533+
* @return {Raven}
534+
*/
535+
setEnvironment: function(environment) {
536+
this._globalOptions.environment = environment;
537+
538+
return this;
496539
},
497540

498541
/*
@@ -1249,6 +1292,9 @@ Raven.prototype = {
12491292
data.user = this._globalContext.user;
12501293
}
12511294

1295+
// Include the environment if it's defined in globalOptions
1296+
if (globalOptions.environment) data.environment = globalOptions.environment;
1297+
12521298
// Include the release if it's defined in globalOptions
12531299
if (globalOptions.release) data.release = globalOptions.release;
12541300

@@ -1362,7 +1408,7 @@ Raven.prototype = {
13621408
// NOTE: auth is intentionally sent as part of query string (NOT as custom
13631409
// HTTP header) so as to avoid preflight CORS requests
13641410
request.open('POST', url + '?' + urlencode(opts.auth));
1365-
request.send(JSON.stringify(opts.data));
1411+
request.send(stringify(opts.data));
13661412
},
13671413

13681414
_logDebug: function(level) {
@@ -1391,7 +1437,7 @@ Raven.prototype.setReleaseContext = Raven.prototype.setRelease;
13911437

13921438
module.exports = Raven;
13931439

1394-
},{"1":1,"2":2,"5":5,"6":6}],4:[function(_dereq_,module,exports){
1440+
},{"1":1,"2":2,"3":3,"6":6,"7":7}],5:[function(_dereq_,module,exports){
13951441
/**
13961442
* Enforces a single instance of the Raven client, and the
13971443
* main entry point for Raven. If you are a consumer of the
@@ -1400,7 +1446,7 @@ module.exports = Raven;
14001446

14011447
'use strict';
14021448

1403-
var RavenConstructor = _dereq_(3);
1449+
var RavenConstructor = _dereq_(4);
14041450

14051451
var _Raven = window.Raven;
14061452

@@ -1421,7 +1467,7 @@ Raven.afterLoad();
14211467

14221468
module.exports = Raven;
14231469

1424-
},{"3":3}],5:[function(_dereq_,module,exports){
1470+
},{"4":4}],6:[function(_dereq_,module,exports){
14251471
/*eslint no-extra-parens:0*/
14261472
'use strict';
14271473

@@ -1679,10 +1725,10 @@ module.exports = {
16791725
parseUrl: parseUrl
16801726
};
16811727

1682-
},{}],6:[function(_dereq_,module,exports){
1728+
},{}],7:[function(_dereq_,module,exports){
16831729
'use strict';
16841730

1685-
var utils = _dereq_(5);
1731+
var utils = _dereq_(6);
16861732

16871733
var hasKey = utils.hasKey;
16881734
var isString = utils.isString;
@@ -2460,5 +2506,5 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
24602506

24612507
module.exports = TraceKit;
24622508

2463-
},{"5":5}]},{},[4])(4)
2509+
},{"6":6}]},{},[5])(5)
24642510
});

dist/raven.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/raven.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)