1
- /*! Raven.js 1.2 .0 (17e3431 ) | github.com/getsentry/raven-js */
1
+ /*! Raven.js 1.3 .0 (768fdca ) | github.com/getsentry/raven-js */
2
2
3
3
/*
4
4
* Includes TraceKit
@@ -29,24 +29,6 @@ var TraceKit = {
29
29
var _slice = [ ] . slice ;
30
30
var UNKNOWN_FUNCTION = '?' ;
31
31
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
- } ;
50
32
51
33
function getLocationHref ( ) {
52
34
if ( typeof document === 'undefined' )
@@ -1128,9 +1110,9 @@ for (var method in originalConsole) {
1128
1110
* @this {Raven}
1129
1111
*/
1130
1112
var Raven = {
1131
- VERSION : '1.2 .0' ,
1113
+ VERSION : '1.3 .0' ,
1132
1114
1133
- debug : true ,
1115
+ debug : false ,
1134
1116
1135
1117
/*
1136
1118
* Allow multiple versions of Raven to be installed.
@@ -1305,6 +1287,7 @@ var Raven = {
1305
1287
wrapped [ property ] = func [ property ] ;
1306
1288
}
1307
1289
}
1290
+ wrapped . prototype = func . prototype ;
1308
1291
1309
1292
// Signal that this function has been wrapped already
1310
1293
// for both debugging and to prevent it to being wrapped twice
@@ -1754,10 +1737,7 @@ function processException(type, message, fileurl, lineno, frames, options) {
1754
1737
if ( ! ! globalOptions . ignoreErrors . test && globalOptions . ignoreErrors . test ( message ) ) return ;
1755
1738
1756
1739
message += '' ;
1757
- message = truncate ( message , globalOptions . maxMessageLength ) ;
1758
-
1759
1740
fullMessage = type + ': ' + message ;
1760
- fullMessage = truncate ( fullMessage , globalOptions . maxMessageLength ) ;
1761
1741
1762
1742
if ( frames && frames . length ) {
1763
1743
fileurl = frames [ 0 ] . filename || fileurl ;
@@ -1783,11 +1763,12 @@ function processException(type, message, fileurl, lineno, frames, options) {
1783
1763
objectMerge ( {
1784
1764
// sentry.interfaces.Exception
1785
1765
exception : {
1786
- type : type ,
1787
- value : message
1766
+ values : [ {
1767
+ type : type ,
1768
+ value : message ,
1769
+ stacktrace : stacktrace
1770
+ } ]
1788
1771
} ,
1789
- // sentry.interfaces.Stacktrace
1790
- stacktrace : stacktrace ,
1791
1772
culprit : fileurl ,
1792
1773
message : fullMessage
1793
1774
} , options )
@@ -1808,6 +1789,19 @@ function truncate(str, max) {
1808
1789
return str . length <= max ? str : str . substr ( 0 , max ) + '\u2026' ;
1809
1790
}
1810
1791
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
+
1811
1805
function now ( ) {
1812
1806
return + new Date ( ) ;
1813
1807
}
@@ -1817,30 +1811,30 @@ function getHttpData() {
1817
1811
return ;
1818
1812
}
1819
1813
1820
- var http = {
1814
+ var httpData = {
1821
1815
headers : {
1822
1816
'User-Agent' : navigator . userAgent
1823
1817
}
1824
1818
} ;
1825
1819
1826
- http . url = document . location . href ;
1820
+ httpData . url = document . location . href ;
1827
1821
1828
1822
if ( document . referrer ) {
1829
- http . headers . Referer = document . referrer ;
1823
+ httpData . headers . Referer = document . referrer ;
1830
1824
}
1831
1825
1832
- return http ;
1826
+ return httpData ;
1833
1827
}
1834
1828
1835
1829
function send ( data ) {
1836
1830
var baseData = {
1837
1831
project : globalProject ,
1838
1832
logger : globalOptions . logger ,
1839
1833
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 ;
1844
1838
}
1845
1839
1846
1840
data = objectMerge ( baseData , data ) ;
@@ -1850,9 +1844,7 @@ function send(data) {
1850
1844
data . extra = objectMerge ( objectMerge ( { } , globalContext . extra ) , data . extra ) ;
1851
1845
1852
1846
// 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 ;
1856
1848
1857
1849
// If there are no tags/extra, strip the key from the payload alltogther.
1858
1850
if ( isEmptyObject ( data . tags ) ) delete data . tags ;
@@ -1864,6 +1856,8 @@ function send(data) {
1864
1856
1865
1857
// Include the release if it's defined in globalOptions
1866
1858
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 ;
1867
1861
1868
1862
if ( isFunction ( globalOptions . dataCallback ) ) {
1869
1863
data = globalOptions . dataCallback ( data ) || data ;
@@ -1884,14 +1878,17 @@ function send(data) {
1884
1878
// Set lastEventId after we know the error should actually be sent
1885
1879
lastEventId = data . event_id || ( data . event_id = uuid4 ( ) ) ;
1886
1880
1881
+ // Try and clean up the packet before sending by truncating long values
1882
+ data = trimPacket ( data ) ;
1883
+
1887
1884
logDebug ( 'debug' , 'Raven about to send:' , data ) ;
1888
1885
1889
1886
if ( ! isSetup ( ) ) return ;
1890
1887
1891
1888
( globalOptions . transport || makeRequest ) ( {
1892
1889
url : globalServer ,
1893
1890
auth : {
1894
- sentry_version : '4 ' ,
1891
+ sentry_version : '7 ' ,
1895
1892
sentry_client : 'raven-js/' + Raven . VERSION ,
1896
1893
sentry_key : globalKey
1897
1894
} ,
@@ -1917,10 +1914,11 @@ function makeRequest(opts) {
1917
1914
opts . auth . sentry_data = JSON . stringify ( opts . data ) ;
1918
1915
1919
1916
var img = newImage ( ) ,
1920
- src = opts . url + '?' + urlencode ( opts . auth ) ;
1917
+ src = opts . url + '?' + urlencode ( opts . auth ) ,
1918
+ crossOrigin = opts . options . crossOrigin ;
1921
1919
1922
- if ( opts . options . crossOrigin || opts . options . crossOrigin === '' ) {
1923
- img . crossOrigin = opts . options . crossOrigin ;
1920
+ if ( crossOrigin || crossOrigin === '' ) {
1921
+ img . crossOrigin = crossOrigin ;
1924
1922
}
1925
1923
img . onload = opts . onSuccess ;
1926
1924
img . onerror = img . onabort = opts . onError ;
0 commit comments