Skip to content

Commit

Permalink
Release v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
petkaantonov committed Jul 7, 2014
1 parent 8331492 commit d221037
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bluebird",
"version": "2.2.0",
"version": "2.2.1",
"homepage": "https://github.com/petkaantonov/bluebird",
"authors": [
"Petka Antonov <[email protected]>"
Expand Down
26 changes: 23 additions & 3 deletions browser/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3878,6 +3878,22 @@ CapturedTrace.combine = function CapturedTrace$Combine(current, prev) {
return ret;
};

CapturedTrace.protectErrorMessageNewlines = function(stack) {
for (var i = 0; i < stack.length; ++i) {
if (rtraceline.test(stack[i])) {
break;
}
}

if (i <= 1) return;

var errorMessageLines = [];
for (var j = 0; j < i; ++j) {
errorMessageLines.push(stack.shift());
}
stack.unshift(errorMessageLines.join("\u0002\u0000\u0001"));
};

CapturedTrace.isSupported = function CapturedTrace$IsSupported() {
return typeof captureStackTrace === "function";
};
Expand Down Expand Up @@ -6021,8 +6037,8 @@ function Promise$_attachExtraTrace(error) {
"canAttach(error)");
var promise = this;
var stack = error.stack;
stack = typeof stack === "string"
? stack.split("\n") : [];
stack = typeof stack === "string" ? stack.split("\n") : [];
CapturedTrace.protectErrorMessageNewlines(stack);
var headerLineCount = 1;
var combinedTraces = 1;
while(promise != null &&
Expand All @@ -6038,9 +6054,13 @@ function Promise$_attachExtraTrace(error) {
var stackTraceLimit = Error.stackTraceLimit || 10;
var max = (stackTraceLimit + headerLineCount) * combinedTraces;
var len = stack.length;
if (len > max) {
if (len > max) {
stack.length = max;
}

if (len > 0)
stack[0] = stack[0].split("\u0002\u0000\u0001").join("\n");

if (stack.length <= headerLineCount) {
error.stack = "(No stack trace)";
} else {
Expand Down
28 changes: 24 additions & 4 deletions js/browser/bluebird.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* bluebird build version 2.2.0
* bluebird build version 2.2.1
* Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, progress, cancel, using, filter, any, each, timers
*/
/**
Expand Down Expand Up @@ -539,6 +539,22 @@ CapturedTrace.combine = function CapturedTrace$Combine(current, prev) {
return ret;
};

CapturedTrace.protectErrorMessageNewlines = function(stack) {
for (var i = 0; i < stack.length; ++i) {
if (rtraceline.test(stack[i])) {
break;
}
}

if (i <= 1) return;

var errorMessageLines = [];
for (var j = 0; j < i; ++j) {
errorMessageLines.push(stack.shift());
}
stack.unshift(errorMessageLines.join("\u0002\u0000\u0001"));
};

CapturedTrace.isSupported = function CapturedTrace$IsSupported() {
return typeof captureStackTrace === "function";
};
Expand Down Expand Up @@ -2614,8 +2630,8 @@ function Promise$_attachExtraTrace(error) {
if (debugging) {
var promise = this;
var stack = error.stack;
stack = typeof stack === "string"
? stack.split("\n") : [];
stack = typeof stack === "string" ? stack.split("\n") : [];
CapturedTrace.protectErrorMessageNewlines(stack);
var headerLineCount = 1;
var combinedTraces = 1;
while(promise != null &&
Expand All @@ -2631,9 +2647,13 @@ function Promise$_attachExtraTrace(error) {
var stackTraceLimit = Error.stackTraceLimit || 10;
var max = (stackTraceLimit + headerLineCount) * combinedTraces;
var len = stack.length;
if (len > max) {
if (len > max) {
stack.length = max;
}

if (len > 0)
stack[0] = stack[0].split("\u0002\u0000\u0001").join("\n");

if (stack.length <= headerLineCount) {
error.stack = "(No stack trace)";
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bluebird",
"description": "Full featured Promises/A+ implementation with exceptionally good performance",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"promise",
"performance",
Expand Down

0 comments on commit d221037

Please sign in to comment.