Skip to content

Commit

Permalink
Add finally handler to LaxPromise
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslan-kurchenko committed Jan 7, 2018
1 parent 5e7be24 commit 3b3d80b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/aura/lax/laxHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
}

const errorConstructor = state === 'INCOMPLETE' ? errors.IncompleteActionError : errors.ApexActionError;
reject(errorConstructor.call({}, message, responseErrors));
reject(new errorConstructor(message, responseErrors));
}
};
}
Expand Down Expand Up @@ -211,6 +211,11 @@
return util.createAuraContextPromise(promise);
},

finally: function (callback) {
const promise = this._contextPromise.finally(callback);
return util.createAuraContextPromise(promise);
},

/**
*
* @method
Expand Down Expand Up @@ -419,7 +424,7 @@
this.name = 'ApexActionError';
this.message = message;
this.entries = entries;
Error.captureStackTrace(this, ApexActionError);
this.stack = (new Error()).stack
}
ApexActionError.prototype = Object.create(Error.prototype);
ApexActionError.prototype.constructor = ApexActionError;
Expand All @@ -429,7 +434,7 @@
this.name = 'IncompleteActionError';
this.message = message;
this.entries = entries;
Error.captureStackTrace(this, IncompleteActionError);
this.stack = (new Error()).stack
}
IncompleteActionError.prototype = Object.create(Error.prototype);
IncompleteActionError.prototype.constructor = IncompleteActionError;
Expand Down

0 comments on commit 3b3d80b

Please sign in to comment.