aboutsummaryrefslogtreecommitdiffstats
path: root/demo/dist/demo.js
diff options
context:
space:
mode:
Diffstat (limited to 'demo/dist/demo.js')
-rw-r--r--demo/dist/demo.js72
1 files changed, 53 insertions, 19 deletions
diff --git a/demo/dist/demo.js b/demo/dist/demo.js
index 65b54f51..86587e10 100644
--- a/demo/dist/demo.js
+++ b/demo/dist/demo.js
@@ -245,7 +245,13 @@ function objectFrozen(obj) {
}
function truncate(str, max) {
- return !max || str.length <= max ? str : str.substr(0, max) + '\u2026';
+ if (typeof max !== 'number') {
+ throw new Error('2nd argument to `truncate` function should be a number');
+ }
+ if (typeof str !== 'string' || max === 0) {
+ return str;
+ }
+ return str.length <= max ? str : str.substr(0, max) + '\u2026';
}
/**
@@ -544,10 +550,9 @@ function jsonSize(value) {
}
function serializeValue(value) {
- var maxLength = 40;
-
if (typeof value === 'string') {
- return value.length <= maxLength ? value : value.substr(0, maxLength - 1) + '\u2026';
+ var maxLength = 40;
+ return truncate(value, maxLength);
} else if (
typeof value === 'number' ||
typeof value === 'boolean' ||
@@ -1777,7 +1782,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.24.0',
+ VERSION: '3.24.2',
debug: false,
@@ -2066,7 +2071,11 @@ Raven.prototype = {
*/
_promiseRejectionHandler: function(event) {
this._logDebug('debug', 'Raven caught unhandled promise rejection:', event);
- this.captureException(event.reason);
+ this.captureException(event.reason, {
+ extra: {
+ unhandledPromiseRejection: true
+ }
+ });
},
/**
@@ -2207,6 +2216,14 @@ Raven.prototype = {
// stack[0] is `throw new Error(msg)` call itself, we are interested in the frame that was just before that, stack[1]
var initialCall = isArray$1(stack.stack) && stack.stack[1];
+
+ // if stack[1] is `Raven.captureException`, it means that someone passed a string to it and we redirected that call
+ // to be handled by `captureMessage`, thus `initialCall` is the 3rd one, not 2nd
+ // initialCall => captureException(string) => captureMessage(string)
+ if (initialCall && initialCall.func === 'Raven.captureException') {
+ initialCall = stack.stack[2];
+ }
+
var fileurl = (initialCall && initialCall.url) || '';
if (
@@ -3004,17 +3021,30 @@ Raven.prototype = {
status_code: null
};
- return origFetch.apply(this, args).then(function(response) {
- fetchData.status_code = response.status;
+ return origFetch
+ .apply(this, args)
+ .then(function(response) {
+ fetchData.status_code = response.status;
- self.captureBreadcrumb({
- type: 'http',
- category: 'fetch',
- data: fetchData
- });
+ self.captureBreadcrumb({
+ type: 'http',
+ category: 'fetch',
+ data: fetchData
+ });
- return response;
- });
+ return response;
+ })
+ ['catch'](function(err) {
+ // if there is an error performing the request
+ self.captureBreadcrumb({
+ type: 'http',
+ category: 'fetch',
+ data: fetchData,
+ level: 'error'
+ });
+
+ throw err;
+ });
};
},
wrappedBuiltIns
@@ -3027,7 +3057,7 @@ Raven.prototype = {
if (_document.addEventListener) {
_document.addEventListener('click', self._breadcrumbEventHandler('click'), false);
_document.addEventListener('keypress', self._keypressEventHandler(), false);
- } else {
+ } else if (_document.attachEvent) {
// IE8 Compatibility
_document.attachEvent('onclick', self._breadcrumbEventHandler('click'));
_document.attachEvent('onkeypress', self._keypressEventHandler());
@@ -3750,7 +3780,11 @@ Raven.prototype = {
},
_logDebug: function(level) {
- if (this._originalConsoleMethods[level] && this.debug) {
+ // We allow `Raven.debug` and `Raven.config(DSN, { debug: true })` to not make backward incompatible API change
+ if (
+ this._originalConsoleMethods[level] &&
+ (this.debug || this._globalOptions.debug)
+ ) {
// In IE<10 console methods do not have their own 'apply' method
Function.prototype.apply.call(
this._originalConsoleMethods[level],
@@ -3823,11 +3857,11 @@ var singleton = Raven$1;
* const someAppReporter = new Raven.Client();
* const someOtherAppReporter = new Raven.Client();
*
- * someAppReporter('__DSN__', {
+ * someAppReporter.config('__DSN__', {
* ...config goes here
* });
*
- * someOtherAppReporter('__OTHER_DSN__', {
+ * someOtherAppReporter.config('__OTHER_DSN__', {
* ...config goes here
* });
*