Skip to content

Commit a0313be

Browse files
committed
Merge pull request mozilla#2570 from mduan/issue2556
Fix bug w/ exception not being passed to error callbacks of a Promise
2 parents d467790 + 4f1e94c commit a0313be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/util.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
503503
this.name = name;
504504
this.isRejected = false;
505505
this.error = null;
506+
this.exception = null;
506507
// If you build a promise and pass in some data it's already resolved.
507508
if (data != null) {
508509
this.isResolved = true;
@@ -611,6 +612,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
611612

612613
this.isRejected = true;
613614
this.error = reason || null;
615+
this.exception = exception || null;
614616
var errbacks = this.errbacks;
615617

616618
for (var i = 0, ii = errbacks.length; i < ii; i++) {
@@ -629,7 +631,8 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
629631
callback.call(null, data);
630632
} else if (this.isRejected && errback) {
631633
var error = this.error;
632-
errback.call(null, error);
634+
var exception = this.exception;
635+
errback.call(null, error, exception);
633636
} else {
634637
this.callbacks.push(callback);
635638
if (errback)

0 commit comments

Comments
 (0)