Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Ignore sync errors in Step.async(), too"

This reverts commit 7f6d7d2.
  • Loading branch information...
commit 50d1cea61ad8da281c403e716c5ad9d1e696593f 1 parent 7f6d7d2
Andreas Kalsch authored
Showing with 6 additions and 7 deletions.
  1. +5 −6 lib/step.js
  2. +1 −1  test/async.js
View
11 lib/step.js
@@ -45,9 +45,9 @@ function _Step(steps, context, ignoreReturn) {
results = [];
// Run the step in a try..catch block so exceptions don't get out of hand.
- var result, e;
try {
lock = true;
+ var result;
// Argument preparation
if (context === next) {
@@ -65,16 +65,15 @@ function _Step(steps, context, ignoreReturn) {
}
result = fn.apply(context, args);
}
- } catch (e_) {
+ } catch (e) {
// Pass any exceptions on through the next callback
- e = e_;
+ next(e);
}
// If a synchronous return is used, pass it to the callback
- if ((e !== undefined || result !== undefined) && !ignoreReturn) {
-
- next(e, result);
+ if (result !== undefined && !ignoreReturn) {
+ next(undefined, result);
}
lock = false;
}
View
2  test/async.js
@@ -11,7 +11,7 @@ Step.async(
function readSelf() {
fulfill("one");
fs.readFile(__filename, 'utf8', this);
- throw new Error();
+ return 1;
},
function capitalize(err, text) {
fulfill("two");
Please sign in to comment.
Something went wrong with that request. Please try again.