From 97a40252dcec831158c29c86bc84000f9546173d Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Tue, 6 Aug 2013 11:40:35 -0700 Subject: [PATCH] Dump the stack with unhandled rejections. --- src/util.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util.js b/src/util.js index a1d7e2b98..c7a84bb60 100644 --- a/src/util.js +++ b/src/util.js @@ -770,8 +770,12 @@ var Promise = PDFJS.Promise = (function PromiseClosure() { var now = Date.now(); for (var i = 0; i < this.unhandledRejections.length; i++) { if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) { - warn('Unhandled rejection: ' + - this.unhandledRejections[i].promise._value); + var unhandled = this.unhandledRejections[i].promise._value; + var msg = 'Unhandled rejection: ' + unhandled; + if (unhandled.stack) { + msg += '\n' + unhandled.stack; + } + warn(msg); this.unhandledRejections.splice(i); i--; }