Skip to content

Commit

Permalink
3.6.0 (getsentry#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar authored and denstepa committed Jan 5, 2017
1 parent 3c2e4a7 commit 4fef33c
Show file tree
Hide file tree
Showing 27 changed files with 131 additions and 69 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 3.6.1
* NEW: `Raven.captureMessage` will generate synthetic stacktraces if passed `stacktrace: true` via options. See: https://github.com/getsentry/raven-js/pull/582
* NEW: Added `Raven.setDSN` for changing target DSN after Raven has been configured. See: https://github.com/getsentry/raven-js/pull/706
* CHANGE: Added missing TypeScript type declarations for Raven API methods. See: https://github.com/getsentry/raven-js/pull/698

## 3.5.1
* BUGFIX: Fix non-fatals crashing React Native plugin unless `shouldSendCallback` is specified. See: https://github.com/getsentry/raven-js/pull/694

Expand Down
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": "3.5.1",
"version": "3.6.0",
"dependencies": {},
"main": "dist/raven.js",
"ignore": [
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/angular.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */

/*
* Includes TraceKit
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/angular.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/console.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */

/*
* Includes TraceKit
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/console.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/ember.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */

/*
* Includes TraceKit
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/ember.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/require.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */

/*
* Includes TraceKit
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/require.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/vue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */

/*
* Includes TraceKit
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/vue.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

127 changes: 92 additions & 35 deletions dist/raven.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Raven.js 3.5.1 (bef9fa7) | github.com/getsentry/raven-js */
/*! Raven.js 3.6.0 (c474a32) | github.com/getsentry/raven-js */

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

debug: false,

Expand Down Expand Up @@ -216,11 +216,7 @@ Raven.prototype = {
});
}

var uri = this._parseDSN(dsn),
lastSlash = uri.path.lastIndexOf('/'),
path = uri.path.substr(1, lastSlash);

this._dsn = dsn;
this.setDSN(dsn);

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

this._globalKey = uri.user;
this._globalSecret = uri.pass && uri.pass.substr(1);
this._globalProject = uri.path.substr(lastSlash + 1);

this._globalServer = this._getGlobalServer(uri);

this._globalEndpoint = this._globalServer +
'/' + path + 'api/' + this._globalProject + '/store/';

TraceKit.collectWindowErrors = !!this._globalOptions.collectWindowErrors;

// return for chaining
Expand Down Expand Up @@ -292,6 +279,27 @@ Raven.prototype = {
return this;
},

/*
* Set the DSN (can be called multiple time unlike config)
*
* @param {string} dsn The public Sentry DSN
*/
setDSN: function(dsn) {
var uri = this._parseDSN(dsn),
lastSlash = uri.path.lastIndexOf('/'),
path = uri.path.substr(1, lastSlash);

this._dsn = dsn;
this._globalKey = uri.user;
this._globalSecret = uri.pass && uri.pass.substr(1);
this._globalProject = uri.path.substr(lastSlash + 1);

this._globalServer = this._getGlobalServer(uri);

this._globalEndpoint = this._globalServer +
'/' + path + 'api/' + this._globalProject + '/store/';
},

/*
* Wrap code within a context so Raven can capture errors
* reliably across domains that is executed immediately.
Expand Down Expand Up @@ -418,7 +426,12 @@ Raven.prototype = {
*/
captureException: function(ex, options) {
// If not an Error is passed through, recall as a message instead
if (!isError(ex)) return this.captureMessage(ex, options);
if (!isError(ex)) {
return this.captureMessage(ex, objectMerge({
trimHeadFrames: 1,
stacktrace: true // if we fall back to captureMessage, default to attempting a new trace
}, options));
}

// Store the raw exception object for potential debugging and introspection
this._lastCapturedException = ex;
Expand Down Expand Up @@ -455,12 +468,41 @@ Raven.prototype = {
return;
}

var data = objectMerge({
message: msg + '' // Make sure it's actually a string
}, options);

if (options && options.stacktrace) {
var ex;
// create a stack trace from this point; just trim
// off extra frames so they don't include this function call (or
// earlier Raven.js library fn calls)
try {
throw new Error(msg);
} catch (ex1) {
ex = ex1;
}

// null exception name so `Error` isn't prefixed to msg
ex.name = null;

options = objectMerge({
// fingerprint on msg, not stack trace (legacy behavior, could be
// revisited)
fingerprint: msg,
trimHeadFrames: (options.trimHeadFrames || 0) + 1
}, options);

var stack = TraceKit.computeStackTrace(ex);
var frames = this._prepareFrames(stack, options);
data.stacktrace = {
// Sentry expects frames oldest to newest
frames: frames.reverse()
}
}

// Fire away!
this._send(
objectMerge({
message: msg + '' // Make sure it's actually a string
}, options)
);
this._send(data);

return this;
},
Expand All @@ -474,6 +516,7 @@ Raven.prototype = {
if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {
this._breadcrumbs.shift();
}
return this;
},

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

_handleStackInfo: function(stackInfo, options) {
var self = this;
var frames = [];

if (stackInfo.stack && stackInfo.stack.length) {
each(stackInfo.stack, function(i, stack) {
var frame = self._normalizeFrame(stack);
if (frame) {
frames.push(frame);
}
});
}
var frames = this._prepareFrames(stackInfo, options);

this._triggerEvent('handle', {
stackInfo: stackInfo,
Expand All @@ -1180,11 +1213,36 @@ Raven.prototype = {
stackInfo.message,
stackInfo.url,
stackInfo.lineno,
frames.slice(0, this._globalOptions.stackTraceLimit),
frames,
options
);
},

_prepareFrames: function(stackInfo, options) {
var self = this;
var frames = [];
if (stackInfo.stack && stackInfo.stack.length) {
each(stackInfo.stack, function(i, stack) {
var frame = self._normalizeFrame(stack);
if (frame) {
frames.push(frame);
}
});

// e.g. frames captured via captureMessage throw
if (options && options.trimHeadFrames) {
for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {
frames[j].in_app = false;
}
// ... delete to prevent from appearing in outbound payload
delete options.trimHeadFrames;
}
}
frames = frames.slice(0, this._globalOptions.stackTraceLimit);
return frames;
},


_normalizeFrame: function(frame) {
if (!frame.url) return;

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

_processException: function(type, message, fileurl, lineno, frames, options) {
var stacktrace;

if (!!this._globalOptions.ignoreErrors.test && this._globalOptions.ignoreErrors.test(message)) return;

message += '';
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.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/sri.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"@dist/raven.js": {
"hashes": {
"sha256": "4T6vX55YCKEdsXm2e848GI/Rw7S0w12FN3qHHd14uYA=",
"sha512": "4zFM5q/2zfwVq/jk4+BG6WrlJK5gRMxhz4zfio9N4a6dLY+WAsgUtK8cr8oJ1RZCdehDxzNng5SYc6R9cSEDDA=="
"sha256": "Rheia/eYhjZUCvaSKwK9BYfWSBhA3i2VD9aleTwdh48=",
"sha512": "LveFv8BWO8kKj9fXm/PtKlscTLt2L/pVdXZs9mlPXs6BtpU4wPmOZaor+KYnztYCPGMV/ScdolhTSZDXx7IP0g=="
},
"type": null,
"integrity": "sha256-4T6vX55YCKEdsXm2e848GI/Rw7S0w12FN3qHHd14uYA= sha512-4zFM5q/2zfwVq/jk4+BG6WrlJK5gRMxhz4zfio9N4a6dLY+WAsgUtK8cr8oJ1RZCdehDxzNng5SYc6R9cSEDDA==",
"integrity": "sha256-Rheia/eYhjZUCvaSKwK9BYfWSBhA3i2VD9aleTwdh48= sha512-LveFv8BWO8kKj9fXm/PtKlscTLt2L/pVdXZs9mlPXs6BtpU4wPmOZaor+KYnztYCPGMV/ScdolhTSZDXx7IP0g==",
"path": "dist/raven.js"
},
"@dist/raven.min.js": {
"hashes": {
"sha256": "x2kubc5sdO++lP5Rqf1l7yFL+rSm+mTWVnsX0k6FmCU=",
"sha512": "/D4L3w7gMg1T0MtevriHRQj19bFMjnbhZ3CaPelYVyW6P2oaAZQ7J+GctzCR44ahwjQRZwa8Ujw6jSpgHJ5WPg=="
"sha256": "DcSOaOnJG0Y/B7DwqDZRjgMprGgUZJ3FnnV+kpWwIRM=",
"sha512": "Olaakub9v7be7qS5eNiIp7lq7R/LznsT4ps6UNS5oISmrcRM+x3Ns68t+/cU+OuaaQrXmC0F5T2GFFGqS+A1VQ=="
},
"type": null,
"integrity": "sha256-x2kubc5sdO++lP5Rqf1l7yFL+rSm+mTWVnsX0k6FmCU= sha512-/D4L3w7gMg1T0MtevriHRQj19bFMjnbhZ3CaPelYVyW6P2oaAZQ7J+GctzCR44ahwjQRZwa8Ujw6jSpgHJ5WPg==",
"integrity": "sha256-DcSOaOnJG0Y/B7DwqDZRjgMprGgUZJ3FnnV+kpWwIRM= sha512-Olaakub9v7be7qS5eNiIp7lq7R/LznsT4ps6UNS5oISmrcRM+x3Ns68t+/cU+OuaaQrXmC0F5T2GFFGqS+A1VQ==",
"path": "dist/raven.min.js"
}
}
2 changes: 1 addition & 1 deletion docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Putting it all together
<body>
...
<script src="jquery.min.js"></script>
<script src="https://cdn.ravenjs.com/3.5.1/raven.min.js"></script>
<script src="https://cdn.ravenjs.com/3.6.0/raven.min.js"></script>
<script>
Raven.config('___PUBLIC_DSN___', {
logger: 'my-logger',
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ scripts. For all details see :doc:`install`.

.. sourcecode:: html

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


Configuring the Client
Expand Down
4 changes: 2 additions & 2 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ So for example:
.. sourcecode:: html

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

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

.. sourcecode:: html

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

This version does not include any plugins. See `ravenjs.com
<http://ravenjs.com/>`_ for more information about plugins and getting
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/angular.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Example:
.. sourcecode:: html

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

Note that this CDN build auto-initializes the Angular plugin.
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/backbone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Start by adding the ``raven.js`` script tag to your page. It should be loaded as

.. sourcecode:: html

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

Configuring the Client
----------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/ember.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Example:
.. sourcecode:: html

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

Note that this CDN build auto-initializes the Ember plugin.
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/react.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Start by adding the ``raven.js`` script tag to your page. It should be loaded as

.. sourcecode:: html

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

Configuring the Client
----------------------
Expand Down
Loading

0 comments on commit 4fef33c

Please sign in to comment.