diff --git a/src/util.js b/src/util.js index de84853b6..4f856b798 100644 --- a/src/util.js +++ b/src/util.js @@ -503,6 +503,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() { this.name = name; this.isRejected = false; this.error = null; + this.exception = null; // If you build a promise and pass in some data it's already resolved. if (data != null) { this.isResolved = true; @@ -611,6 +612,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() { this.isRejected = true; this.error = reason || null; + this.exception = exception || null; var errbacks = this.errbacks; for (var i = 0, ii = errbacks.length; i < ii; i++) { @@ -629,7 +631,8 @@ var Promise = PDFJS.Promise = (function PromiseClosure() { callback.call(null, data); } else if (this.isRejected && errback) { var error = this.error; - errback.call(null, error); + var exception = this.exception; + errback.call(null, error, exception); } else { this.callbacks.push(callback); if (errback)