Skip to content

Commit 4db84e1

Browse files
authored
3.6.0 (#708)
1 parent b0dc3e2 commit 4db84e1

27 files changed

+131
-69
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.6.1
4+
* NEW: `Raven.captureMessage` will generate synthetic stacktraces if passed `stacktrace: true` via options. See: https://github.com/getsentry/raven-js/pull/582
5+
* NEW: Added `Raven.setDSN` for changing target DSN after Raven has been configured. See: https://github.com/getsentry/raven-js/pull/706
6+
* CHANGE: Added missing TypeScript type declarations for Raven API methods. See: https://github.com/getsentry/raven-js/pull/698
7+
38
## 3.5.1
49
* BUGFIX: Fix non-fatals crashing React Native plugin unless `shouldSendCallback` is specified. See: https://github.com/getsentry/raven-js/pull/694
510

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "raven-js",
3-
"version": "3.5.1",
3+
"version": "3.6.0",
44
"dependencies": {},
55
"main": "dist/raven.js",
66
"ignore": [

dist/plugins/angular.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

dist/plugins/angular.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/console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.6.0 (c474a32) | 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.5.1 (bef9fa7) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.6.0 (c474a32) | 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.5.1 (bef9fa7) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.6.0 (c474a32) | 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/plugins/vue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

dist/plugins/vue.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: 92 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit
@@ -182,7 +182,7 @@ Raven.prototype = {
182182
// webpack (using a build step causes webpack #1617). Grunt verifies that
183183
// this value matches package.json during build.
184184
// See: https://github.com/getsentry/raven-js/issues/465
185-
VERSION: '3.5.1',
185+
VERSION: '3.6.0',
186186

187187
debug: false,
188188

@@ -216,11 +216,7 @@ Raven.prototype = {
216216
});
217217
}
218218

219-
var uri = this._parseDSN(dsn),
220-
lastSlash = uri.path.lastIndexOf('/'),
221-
path = uri.path.substr(1, lastSlash);
222-
223-
this._dsn = dsn;
219+
this.setDSN(dsn);
224220

225221
// "Script error." is hard coded into browsers for errors that it can't read.
226222
// this is the result of a script being pulled in from an external domain and CORS.
@@ -249,15 +245,6 @@ Raven.prototype = {
249245
}
250246
this._globalOptions.autoBreadcrumbs = autoBreadcrumbs;
251247

252-
this._globalKey = uri.user;
253-
this._globalSecret = uri.pass && uri.pass.substr(1);
254-
this._globalProject = uri.path.substr(lastSlash + 1);
255-
256-
this._globalServer = this._getGlobalServer(uri);
257-
258-
this._globalEndpoint = this._globalServer +
259-
'/' + path + 'api/' + this._globalProject + '/store/';
260-
261248
TraceKit.collectWindowErrors = !!this._globalOptions.collectWindowErrors;
262249

263250
// return for chaining
@@ -292,6 +279,27 @@ Raven.prototype = {
292279
return this;
293280
},
294281

282+
/*
283+
* Set the DSN (can be called multiple time unlike config)
284+
*
285+
* @param {string} dsn The public Sentry DSN
286+
*/
287+
setDSN: function(dsn) {
288+
var uri = this._parseDSN(dsn),
289+
lastSlash = uri.path.lastIndexOf('/'),
290+
path = uri.path.substr(1, lastSlash);
291+
292+
this._dsn = dsn;
293+
this._globalKey = uri.user;
294+
this._globalSecret = uri.pass && uri.pass.substr(1);
295+
this._globalProject = uri.path.substr(lastSlash + 1);
296+
297+
this._globalServer = this._getGlobalServer(uri);
298+
299+
this._globalEndpoint = this._globalServer +
300+
'/' + path + 'api/' + this._globalProject + '/store/';
301+
},
302+
295303
/*
296304
* Wrap code within a context so Raven can capture errors
297305
* reliably across domains that is executed immediately.
@@ -418,7 +426,12 @@ Raven.prototype = {
418426
*/
419427
captureException: function(ex, options) {
420428
// If not an Error is passed through, recall as a message instead
421-
if (!isError(ex)) return this.captureMessage(ex, options);
429+
if (!isError(ex)) {
430+
return this.captureMessage(ex, objectMerge({
431+
trimHeadFrames: 1,
432+
stacktrace: true // if we fall back to captureMessage, default to attempting a new trace
433+
}, options));
434+
}
422435

423436
// Store the raw exception object for potential debugging and introspection
424437
this._lastCapturedException = ex;
@@ -455,12 +468,41 @@ Raven.prototype = {
455468
return;
456469
}
457470

471+
var data = objectMerge({
472+
message: msg + '' // Make sure it's actually a string
473+
}, options);
474+
475+
if (options && options.stacktrace) {
476+
var ex;
477+
// create a stack trace from this point; just trim
478+
// off extra frames so they don't include this function call (or
479+
// earlier Raven.js library fn calls)
480+
try {
481+
throw new Error(msg);
482+
} catch (ex1) {
483+
ex = ex1;
484+
}
485+
486+
// null exception name so `Error` isn't prefixed to msg
487+
ex.name = null;
488+
489+
options = objectMerge({
490+
// fingerprint on msg, not stack trace (legacy behavior, could be
491+
// revisited)
492+
fingerprint: msg,
493+
trimHeadFrames: (options.trimHeadFrames || 0) + 1
494+
}, options);
495+
496+
var stack = TraceKit.computeStackTrace(ex);
497+
var frames = this._prepareFrames(stack, options);
498+
data.stacktrace = {
499+
// Sentry expects frames oldest to newest
500+
frames: frames.reverse()
501+
}
502+
}
503+
458504
// Fire away!
459-
this._send(
460-
objectMerge({
461-
message: msg + '' // Make sure it's actually a string
462-
}, options)
463-
);
505+
this._send(data);
464506

465507
return this;
466508
},
@@ -474,6 +516,7 @@ Raven.prototype = {
474516
if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {
475517
this._breadcrumbs.shift();
476518
}
519+
return this;
477520
},
478521

479522
addPlugin: function(plugin /*arg1, arg2, ... argN*/) {
@@ -1158,17 +1201,7 @@ Raven.prototype = {
11581201
},
11591202

11601203
_handleStackInfo: function(stackInfo, options) {
1161-
var self = this;
1162-
var frames = [];
1163-
1164-
if (stackInfo.stack && stackInfo.stack.length) {
1165-
each(stackInfo.stack, function(i, stack) {
1166-
var frame = self._normalizeFrame(stack);
1167-
if (frame) {
1168-
frames.push(frame);
1169-
}
1170-
});
1171-
}
1204+
var frames = this._prepareFrames(stackInfo, options);
11721205

11731206
this._triggerEvent('handle', {
11741207
stackInfo: stackInfo,
@@ -1180,11 +1213,36 @@ Raven.prototype = {
11801213
stackInfo.message,
11811214
stackInfo.url,
11821215
stackInfo.lineno,
1183-
frames.slice(0, this._globalOptions.stackTraceLimit),
1216+
frames,
11841217
options
11851218
);
11861219
},
11871220

1221+
_prepareFrames: function(stackInfo, options) {
1222+
var self = this;
1223+
var frames = [];
1224+
if (stackInfo.stack && stackInfo.stack.length) {
1225+
each(stackInfo.stack, function(i, stack) {
1226+
var frame = self._normalizeFrame(stack);
1227+
if (frame) {
1228+
frames.push(frame);
1229+
}
1230+
});
1231+
1232+
// e.g. frames captured via captureMessage throw
1233+
if (options && options.trimHeadFrames) {
1234+
for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {
1235+
frames[j].in_app = false;
1236+
}
1237+
// ... delete to prevent from appearing in outbound payload
1238+
delete options.trimHeadFrames;
1239+
}
1240+
}
1241+
frames = frames.slice(0, this._globalOptions.stackTraceLimit);
1242+
return frames;
1243+
},
1244+
1245+
11881246
_normalizeFrame: function(frame) {
11891247
if (!frame.url) return;
11901248

@@ -1210,7 +1268,6 @@ Raven.prototype = {
12101268

12111269
_processException: function(type, message, fileurl, lineno, frames, options) {
12121270
var stacktrace;
1213-
12141271
if (!!this._globalOptions.ignoreErrors.test && this._globalOptions.ignoreErrors.test(message)) return;
12151272

12161273
message += '';

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.

dist/sri.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"@dist/raven.js": {
33
"hashes": {
4-
"sha256": "4T6vX55YCKEdsXm2e848GI/Rw7S0w12FN3qHHd14uYA=",
5-
"sha512": "4zFM5q/2zfwVq/jk4+BG6WrlJK5gRMxhz4zfio9N4a6dLY+WAsgUtK8cr8oJ1RZCdehDxzNng5SYc6R9cSEDDA=="
4+
"sha256": "Rheia/eYhjZUCvaSKwK9BYfWSBhA3i2VD9aleTwdh48=",
5+
"sha512": "LveFv8BWO8kKj9fXm/PtKlscTLt2L/pVdXZs9mlPXs6BtpU4wPmOZaor+KYnztYCPGMV/ScdolhTSZDXx7IP0g=="
66
},
77
"type": null,
8-
"integrity": "sha256-4T6vX55YCKEdsXm2e848GI/Rw7S0w12FN3qHHd14uYA= sha512-4zFM5q/2zfwVq/jk4+BG6WrlJK5gRMxhz4zfio9N4a6dLY+WAsgUtK8cr8oJ1RZCdehDxzNng5SYc6R9cSEDDA==",
8+
"integrity": "sha256-Rheia/eYhjZUCvaSKwK9BYfWSBhA3i2VD9aleTwdh48= sha512-LveFv8BWO8kKj9fXm/PtKlscTLt2L/pVdXZs9mlPXs6BtpU4wPmOZaor+KYnztYCPGMV/ScdolhTSZDXx7IP0g==",
99
"path": "dist/raven.js"
1010
},
1111
"@dist/raven.min.js": {
1212
"hashes": {
13-
"sha256": "x2kubc5sdO++lP5Rqf1l7yFL+rSm+mTWVnsX0k6FmCU=",
14-
"sha512": "/D4L3w7gMg1T0MtevriHRQj19bFMjnbhZ3CaPelYVyW6P2oaAZQ7J+GctzCR44ahwjQRZwa8Ujw6jSpgHJ5WPg=="
13+
"sha256": "DcSOaOnJG0Y/B7DwqDZRjgMprGgUZJ3FnnV+kpWwIRM=",
14+
"sha512": "Olaakub9v7be7qS5eNiIp7lq7R/LznsT4ps6UNS5oISmrcRM+x3Ns68t+/cU+OuaaQrXmC0F5T2GFFGqS+A1VQ=="
1515
},
1616
"type": null,
17-
"integrity": "sha256-x2kubc5sdO++lP5Rqf1l7yFL+rSm+mTWVnsX0k6FmCU= sha512-/D4L3w7gMg1T0MtevriHRQj19bFMjnbhZ3CaPelYVyW6P2oaAZQ7J+GctzCR44ahwjQRZwa8Ujw6jSpgHJ5WPg==",
17+
"integrity": "sha256-DcSOaOnJG0Y/B7DwqDZRjgMprGgUZJ3FnnV+kpWwIRM= sha512-Olaakub9v7be7qS5eNiIp7lq7R/LznsT4ps6UNS5oISmrcRM+x3Ns68t+/cU+OuaaQrXmC0F5T2GFFGqS+A1VQ==",
1818
"path": "dist/raven.min.js"
1919
}
2020
}

docs/config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ Putting it all together
269269
<body>
270270
...
271271
<script src="jquery.min.js"></script>
272-
<script src="https://cdn.ravenjs.com/3.5.1/raven.min.js"></script>
272+
<script src="https://cdn.ravenjs.com/3.6.0/raven.min.js"></script>
273273
<script>
274274
Raven.config('___PUBLIC_DSN___', {
275275
logger: 'my-logger',

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ scripts. For all details see :doc:`install`.
2626

2727
.. sourcecode:: html
2828

29-
<script src="https://cdn.ravenjs.com/3.5.1/raven.min.js"></script>
29+
<script src="https://cdn.ravenjs.com/3.6.0/raven.min.js"></script>
3030

3131

3232
Configuring the Client

docs/install.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ So for example:
99
.. sourcecode:: html
1010

1111
<script src="jquery.js"></script>
12-
<script src="https://cdn.ravenjs.com/3.5.1/raven.min.js"></script>
12+
<script src="https://cdn.ravenjs.com/3.6.0/raven.min.js"></script>
1313
<script>Raven.config('___PUBLIC_DSN___').install();</script>
1414
<script src="app.js"></script>
1515

@@ -28,7 +28,7 @@ Our CDN distributes builds with and without :doc:`integrations <integrations/ind
2828

2929
.. sourcecode:: html
3030

31-
<script src="https://cdn.ravenjs.com/3.5.1/raven.min.js"></script>
31+
<script src="https://cdn.ravenjs.com/3.6.0/raven.min.js"></script>
3232

3333
This version does not include any plugins. See `ravenjs.com
3434
<http://ravenjs.com/>`_ for more information about plugins and getting

docs/integrations/angular.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Example:
2424
.. sourcecode:: html
2525

2626
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
27-
<script src="https://cdn.ravenjs.com/3.5.1/angular/raven.min.js"></script>
27+
<script src="https://cdn.ravenjs.com/3.6.0/angular/raven.min.js"></script>
2828
<script>Raven.config('___PUBLIC_DSN___').install();</script>
2929

3030
Note that this CDN build auto-initializes the Angular plugin.

docs/integrations/backbone.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Start by adding the ``raven.js`` script tag to your page. It should be loaded as
88

99
.. sourcecode:: html
1010

11-
<script src="https://cdn.ravenjs.com/3.5.1/raven.min.js"></script>
11+
<script src="https://cdn.ravenjs.com/3.6.0/raven.min.js"></script>
1212

1313
Configuring the Client
1414
----------------------

docs/integrations/ember.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Example:
2323
.. sourcecode:: html
2424

2525
<script src="http://builds.emberjs.com/tags/v2.3.1/ember.prod.js"></script>
26-
<script src="https://cdn.ravenjs.com/3.5.1/ember/raven.min.js"></script>
26+
<script src="https://cdn.ravenjs.com/3.6.0/ember/raven.min.js"></script>
2727
<script>Raven.config('___PUBLIC_DSN___').install();</script>
2828

2929
Note that this CDN build auto-initializes the Ember plugin.

docs/integrations/react.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Start by adding the ``raven.js`` script tag to your page. It should be loaded as
88

99
.. sourcecode:: html
1010

11-
<script src="https://cdn.ravenjs.com/3.5.1/raven.min.js"></script>
11+
<script src="https://cdn.ravenjs.com/3.6.0/raven.min.js"></script>
1212

1313
Configuring the Client
1414
----------------------

0 commit comments

Comments
 (0)