Skip to content

Commit f1a619b

Browse files
committed
Defend against JSON.stringify exceptions, bump version, update changelog
1 parent 7d4f90e commit f1a619b

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 3.2.1
2+
3+
* Defend against `JSON.stringify` exceptions when formatting unhandled rejection output.
4+
15
### 3.2.0
26

37
* Potentially unhandled rejections are now logged to `console.error` by default, even without using `done` or `when/monitor/console`. As before, enabling `when/monitor/console` still adds long async stack traces, and using `done` still makes errors fatal. See [Debugging Promises](docs/api.md#debugging-promises) for more info.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "when",
3-
"version": "3.2.0",
3+
"version": "3.2.1",
44
"main": "when.js",
55
"moduleType": ["amd", "node"],
66
"description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.",

monitor/ConsoleReporter.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ define(function(require) {
7171
if (typeof console.log ==='function'
7272
&& typeof JSON !== 'undefined') {
7373
log = warn = function (x) {
74-
console.log(typeof x === 'string' ? x : JSON.stringify(x));
74+
if(typeof x !== 'string') {
75+
try {
76+
x = JSON.stringify(x);
77+
} catch(e) {}
78+
}
79+
console.log(x);
7580
};
7681
}
7782
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "when",
3-
"version": "3.2.0",
3+
"version": "3.2.1",
44
"description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.",
55
"keywords": [
66
"cujo",

test/buster.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
// Throttle back potentially unhandled rejection reporting
2-
// since buster seems to hold onto promises returned from test cases
3-
// without observing them immediately.
4-
// Still report, just wait longer to give them a chance to be observed
5-
var unhandledRejections = require('../lib/decorators/unhandledRejection');
6-
unhandledRejections(require('../when').Promise, function(f) {
7-
setTimeout(f, 1000);
8-
});
9-
101
exports.node = {
112
environment: 'node',
123
rootPath: '../',

when.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* when is part of the cujoJS family of libraries (http://cujojs.com/)
66
* @author Brian Cavalier
77
* @author John Hann
8-
* @version 3.2.0
8+
* @version 3.2.1
99
*/
1010
(function(define) { 'use strict';
1111
define(function (require) {

0 commit comments

Comments
 (0)