Skip to content

Commit 3c65e28

Browse files
committed
3.23.2
1 parent 72f8e05 commit 3c65e28

22 files changed

+827
-72
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 3.23.2
4+
5+
**NOTE**:
6+
This release may introduce some new events for the same errors, as we'll provide more information on them now.
7+
Your Sentry Issues stream may show new errors, without any changes done to your application's code.
8+
9+
* NEW: Sensible non-Error exception serializer (#1253)
10+
* BUGFIX: Create correct fingerprint when using synthetic stacktraces (#1246)
11+
312
## 3.23.1
413

514
* BUGFIX: Check if `addEventListener` and `removeEventListener` are present before calling them

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.23.1",
3+
"version": "3.23.2",
44
"dependencies": {},
55
"main": "dist/raven.js",
66
"ignore": [

dist/plugins/angular.js

Lines changed: 174 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.23.1 (84edddc) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.23.2 (72f8e05) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit
@@ -88,6 +88,8 @@ module.exports = angularPlugin;
8888

8989
},{"2":2}],2:[function(_dereq_,module,exports){
9090
(function (global){
91+
var stringify = _dereq_(3);
92+
9193
var _window =
9294
typeof window !== 'undefined'
9395
? window
@@ -531,6 +533,98 @@ function safeJoin(input, delimiter) {
531533
return output.join(delimiter);
532534
}
533535

536+
// Default Node.js REPL depth
537+
var MAX_SERIALIZE_EXCEPTION_DEPTH = 3;
538+
// 50kB, as 100kB is max payload size, so half sounds reasonable
539+
var MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024;
540+
var MAX_SERIALIZE_KEYS_LENGTH = 40;
541+
542+
function utf8Length(value) {
543+
return ~-encodeURI(value).split(/%..|./).length;
544+
}
545+
546+
function jsonSize(value) {
547+
return utf8Length(JSON.stringify(value));
548+
}
549+
550+
function serializeValue(value) {
551+
var maxLength = 40;
552+
553+
if (typeof value === 'string') {
554+
return value.length <= maxLength ? value : value.substr(0, maxLength - 1) + '\u2026';
555+
} else if (
556+
typeof value === 'number' ||
557+
typeof value === 'boolean' ||
558+
typeof value === 'undefined'
559+
) {
560+
return value;
561+
}
562+
563+
var type = Object.prototype.toString.call(value);
564+
565+
// Node.js REPL notation
566+
if (type === '[object Object]') return '[Object]';
567+
if (type === '[object Array]') return '[Array]';
568+
if (type === '[object Function]')
569+
return value.name ? '[Function: ' + value.name + ']' : '[Function]';
570+
571+
return value;
572+
}
573+
574+
function serializeObject(value, depth) {
575+
if (depth === 0) return serializeValue(value);
576+
577+
if (isPlainObject(value)) {
578+
return Object.keys(value).reduce(function(acc, key) {
579+
acc[key] = serializeObject(value[key], depth - 1);
580+
return acc;
581+
}, {});
582+
} else if (Array.isArray(value)) {
583+
return value.map(function(val) {
584+
return serializeObject(val, depth - 1);
585+
});
586+
}
587+
588+
return serializeValue(value);
589+
}
590+
591+
function serializeException(ex, depth, maxSize) {
592+
if (!isPlainObject(ex)) return ex;
593+
594+
depth = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_DEPTH : depth;
595+
maxSize = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_SIZE : maxSize;
596+
597+
var serialized = serializeObject(ex, depth);
598+
599+
if (jsonSize(stringify(serialized)) > maxSize) {
600+
return serializeException(ex, depth - 1);
601+
}
602+
603+
return serialized;
604+
}
605+
606+
function serializeKeysForMessage(keys, maxLength) {
607+
if (typeof keys === 'number' || typeof keys === 'string') return keys.toString();
608+
if (!Array.isArray(keys)) return '';
609+
610+
keys = keys.filter(function(key) {
611+
return typeof key === 'string';
612+
});
613+
if (keys.length === 0) return '[object has no keys]';
614+
615+
maxLength = typeof maxLength !== 'number' ? MAX_SERIALIZE_KEYS_LENGTH : maxLength;
616+
if (keys[0].length >= maxLength) return keys[0];
617+
618+
for (var usedKeys = keys.length; usedKeys > 0; usedKeys--) {
619+
var serialized = keys.slice(0, usedKeys).join(', ');
620+
if (serialized.length > maxLength) continue;
621+
if (usedKeys === keys.length) return serialized;
622+
return serialized + '\u2026';
623+
}
624+
625+
return '';
626+
}
627+
534628
module.exports = {
535629
isObject: isObject,
536630
isError: isError,
@@ -560,9 +654,87 @@ module.exports = {
560654
isSameStacktrace: isSameStacktrace,
561655
parseUrl: parseUrl,
562656
fill: fill,
563-
safeJoin: safeJoin
657+
safeJoin: safeJoin,
658+
serializeException: serializeException,
659+
serializeKeysForMessage: serializeKeysForMessage
564660
};
565661

566662
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
663+
},{"3":3}],3:[function(_dereq_,module,exports){
664+
/*
665+
json-stringify-safe
666+
Like JSON.stringify, but doesn't throw on circular references.
667+
668+
Originally forked from https://github.com/isaacs/json-stringify-safe
669+
version 5.0.1 on 3/8/2017 and modified to handle Errors serialization
670+
and IE8 compatibility. Tests for this are in test/vendor.
671+
672+
ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE
673+
*/
674+
675+
exports = module.exports = stringify;
676+
exports.getSerialize = serializer;
677+
678+
function indexOf(haystack, needle) {
679+
for (var i = 0; i < haystack.length; ++i) {
680+
if (haystack[i] === needle) return i;
681+
}
682+
return -1;
683+
}
684+
685+
function stringify(obj, replacer, spaces, cycleReplacer) {
686+
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
687+
}
688+
689+
// https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106
690+
function stringifyError(value) {
691+
var err = {
692+
// These properties are implemented as magical getters and don't show up in for in
693+
stack: value.stack,
694+
message: value.message,
695+
name: value.name
696+
};
697+
698+
for (var i in value) {
699+
if (Object.prototype.hasOwnProperty.call(value, i)) {
700+
err[i] = value[i];
701+
}
702+
}
703+
704+
return err;
705+
}
706+
707+
function serializer(replacer, cycleReplacer) {
708+
var stack = [];
709+
var keys = [];
710+
711+
if (cycleReplacer == null) {
712+
cycleReplacer = function(key, value) {
713+
if (stack[0] === value) {
714+
return '[Circular ~]';
715+
}
716+
return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']';
717+
};
718+
}
719+
720+
return function(key, value) {
721+
if (stack.length > 0) {
722+
var thisPos = indexOf(stack, this);
723+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
724+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
725+
726+
if (~indexOf(stack, value)) {
727+
value = cycleReplacer.call(this, key, value);
728+
}
729+
} else {
730+
stack.push(value);
731+
}
732+
733+
return replacer == null
734+
? value instanceof Error ? stringifyError(value) : value
735+
: replacer.call(this, key, value);
736+
};
737+
}
738+
567739
},{}]},{},[1])(1)
568740
});

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

0 commit comments

Comments
 (0)