Skip to content

Commit 9fa22b0

Browse files
committed
1.3.0
1 parent 768fdca commit 9fa22b0

13 files changed

+82
-55
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 1.3.0
4+
* CHANGE: `console` plugin will now send all arguments as an `extra` value. See: https://github.com/getsentry/raven-js/pull/398
5+
* CHANGE: Bump to v7 of the Sentry API spec. This now requires a Sentry 7.7.0+ https://github.com/getsentry/raven-js/pull/403
6+
* CHANGE: Revamp of AngularJS plugin. Please see documentation. See: https://github.com/getsentry/raven-js/pull/405
7+
* CHANGE: `Raven.debug` now defaults to `false`. https://github.com/getsentry/raven-js/commit/dc142b88f0c4953f54cb3754f9015d95ada55ba0
8+
* BUGFIX: `Raven.wrap` now correctly preserves `prototype`. See: https://github.com/getsentry/raven-js/issues/401 and https://github.com/getsentry/raven-js/pull/402
9+
* NEW: `serverName` config option. https://github.com/getsentry/raven-js/pull/404
10+
* NEW: Experimental support for React Native added.
11+
312
## 1.2.0
413
* BUGFIX: Error in cases where a `document` context doesn't exist. See: https://github.com/getsentry/raven-js/pull/383
514
* BUGFIX: Trailing comma when using unminified dist which affects IE9. See: https://github.com/getsentry/raven-js/pull/385

bower.json

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

dist/raven.js

+41-43
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 1.2.0 (17e3431) | github.com/getsentry/raven-js */
1+
/*! Raven.js 1.3.0 (768fdca) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit
@@ -29,24 +29,6 @@ var TraceKit = {
2929
var _slice = [].slice;
3030
var UNKNOWN_FUNCTION = '?';
3131

32-
/**
33-
* TraceKit.wrap: Wrap any function in a TraceKit reporter
34-
* Example: func = TraceKit.wrap(func);
35-
*
36-
* @param {Function} func Function to be wrapped
37-
* @return {Function} The wrapped func
38-
*/
39-
TraceKit.wrap = function traceKitWrapper(func) {
40-
function wrapped() {
41-
try {
42-
return func.apply(this, arguments);
43-
} catch (e) {
44-
TraceKit.report(e);
45-
throw e;
46-
}
47-
}
48-
return wrapped;
49-
};
5032

5133
function getLocationHref() {
5234
if (typeof document === 'undefined')
@@ -1128,9 +1110,9 @@ for (var method in originalConsole) {
11281110
* @this {Raven}
11291111
*/
11301112
var Raven = {
1131-
VERSION: '1.2.0',
1113+
VERSION: '1.3.0',
11321114

1133-
debug: true,
1115+
debug: false,
11341116

11351117
/*
11361118
* Allow multiple versions of Raven to be installed.
@@ -1305,6 +1287,7 @@ var Raven = {
13051287
wrapped[property] = func[property];
13061288
}
13071289
}
1290+
wrapped.prototype = func.prototype;
13081291

13091292
// Signal that this function has been wrapped already
13101293
// for both debugging and to prevent it to being wrapped twice
@@ -1754,10 +1737,7 @@ function processException(type, message, fileurl, lineno, frames, options) {
17541737
if (!!globalOptions.ignoreErrors.test && globalOptions.ignoreErrors.test(message)) return;
17551738

17561739
message += '';
1757-
message = truncate(message, globalOptions.maxMessageLength);
1758-
17591740
fullMessage = type + ': ' + message;
1760-
fullMessage = truncate(fullMessage, globalOptions.maxMessageLength);
17611741

17621742
if (frames && frames.length) {
17631743
fileurl = frames[0].filename || fileurl;
@@ -1783,11 +1763,12 @@ function processException(type, message, fileurl, lineno, frames, options) {
17831763
objectMerge({
17841764
// sentry.interfaces.Exception
17851765
exception: {
1786-
type: type,
1787-
value: message
1766+
values: [{
1767+
type: type,
1768+
value: message,
1769+
stacktrace: stacktrace
1770+
}]
17881771
},
1789-
// sentry.interfaces.Stacktrace
1790-
stacktrace: stacktrace,
17911772
culprit: fileurl,
17921773
message: fullMessage
17931774
}, options)
@@ -1808,6 +1789,19 @@ function truncate(str, max) {
18081789
return str.length <= max ? str : str.substr(0, max) + '\u2026';
18091790
}
18101791

1792+
function trimPacket(data) {
1793+
// For now, we only want to truncate the two different messages
1794+
// but this could/should be expanded to just trim everything
1795+
var max = globalOptions.maxMessageLength;
1796+
data.message = truncate(data.message, max);
1797+
if (data.exception) {
1798+
var exception = data.exception.values[0];
1799+
exception.value = truncate(exception.value, max);
1800+
}
1801+
1802+
return data;
1803+
}
1804+
18111805
function now() {
18121806
return +new Date();
18131807
}
@@ -1817,30 +1811,30 @@ function getHttpData() {
18171811
return;
18181812
}
18191813

1820-
var http = {
1814+
var httpData = {
18211815
headers: {
18221816
'User-Agent': navigator.userAgent
18231817
}
18241818
};
18251819

1826-
http.url = document.location.href;
1820+
httpData.url = document.location.href;
18271821

18281822
if (document.referrer) {
1829-
http.headers.Referer = document.referrer;
1823+
httpData.headers.Referer = document.referrer;
18301824
}
18311825

1832-
return http;
1826+
return httpData;
18331827
}
18341828

18351829
function send(data) {
18361830
var baseData = {
18371831
project: globalProject,
18381832
logger: globalOptions.logger,
18391833
platform: 'javascript'
1840-
};
1841-
var http = getHttpData();
1842-
if (http) {
1843-
baseData.request = http;
1834+
}, httpData = getHttpData();
1835+
1836+
if (httpData) {
1837+
baseData.request = httpData;
18441838
}
18451839

18461840
data = objectMerge(baseData, data);
@@ -1850,9 +1844,7 @@ function send(data) {
18501844
data.extra = objectMerge(objectMerge({}, globalContext.extra), data.extra);
18511845

18521846
// Send along our own collected metadata with extra
1853-
data.extra = objectMerge({
1854-
'session:duration': now() - startTime
1855-
}, data.extra);
1847+
data.extra['session:duration'] = now() - startTime;
18561848

18571849
// If there are no tags/extra, strip the key from the payload alltogther.
18581850
if (isEmptyObject(data.tags)) delete data.tags;
@@ -1864,6 +1856,8 @@ function send(data) {
18641856

18651857
// Include the release if it's defined in globalOptions
18661858
if (globalOptions.release) data.release = globalOptions.release;
1859+
// Include server_name if it's defined in globalOptions
1860+
if (globalOptions.serverName) data.server_name = globalOptions.serverName;
18671861

18681862
if (isFunction(globalOptions.dataCallback)) {
18691863
data = globalOptions.dataCallback(data) || data;
@@ -1884,14 +1878,17 @@ function send(data) {
18841878
// Set lastEventId after we know the error should actually be sent
18851879
lastEventId = data.event_id || (data.event_id = uuid4());
18861880

1881+
// Try and clean up the packet before sending by truncating long values
1882+
data = trimPacket(data);
1883+
18871884
logDebug('debug', 'Raven about to send:', data);
18881885

18891886
if (!isSetup()) return;
18901887

18911888
(globalOptions.transport || makeRequest)({
18921889
url: globalServer,
18931890
auth: {
1894-
sentry_version: '4',
1891+
sentry_version: '7',
18951892
sentry_client: 'raven-js/' + Raven.VERSION,
18961893
sentry_key: globalKey
18971894
},
@@ -1917,10 +1914,11 @@ function makeRequest(opts) {
19171914
opts.auth.sentry_data = JSON.stringify(opts.data);
19181915

19191916
var img = newImage(),
1920-
src = opts.url + '?' + urlencode(opts.auth);
1917+
src = opts.url + '?' + urlencode(opts.auth),
1918+
crossOrigin = opts.options.crossOrigin;
19211919

1922-
if (opts.options.crossOrigin || opts.options.crossOrigin === '') {
1923-
img.crossOrigin = opts.options.crossOrigin;
1920+
if (crossOrigin || crossOrigin === '') {
1921+
img.crossOrigin = crossOrigin;
19241922
}
19251923
img.onload = opts.onSuccess;
19261924
img.onerror = img.onabort = opts.onError;

0 commit comments

Comments
 (0)