Throw ret value from wait() only if it's there.

pull/22966/head
Ryan Dahl 2009-09-20 17:35:07 +02:00
parent 389c80aece
commit 3311122ccb
1 changed files with 7 additions and 1 deletions

View File

@ -51,7 +51,13 @@ node.Promise.prototype.wait = function () {
})
.block();
if (had_error) throw ret;
if (had_error) {
if (ret) {
throw ret;
} else {
throw new Error("Promise completed with error (No arguments given.)");
}
}
return ret;
};