Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ensure promise#error emits instanceof Error

  • Loading branch information...
commit e5e01adfc3d4c837140d8e2f03e51dc94068b443 1 parent 8465724
@aheckmann aheckmann authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/promise.js
View
6 lib/promise.js
@@ -76,9 +76,9 @@ Promise.prototype.complete = function () {
* @api public
*/
-Promise.prototype.error = function () {
- var args = util.args(arguments);
- return this.emit.apply(this, ['err'].concat(args));
+Promise.prototype.error = function (err) {
+ if (!(err instanceof Error)) err = new Error(err);
+ return this.emit('err', err);
};
/**
Please sign in to comment.
Something went wrong with that request. Please try again.