Skip to content

Commit

Permalink
Streamline Deps exception path
Browse files Browse the repository at this point in the history
For debugging, it's better to not rethrow an exception if possible.  This code should be equivalent.
  • Loading branch information
dgreensp committed Apr 4, 2014
1 parent c65038c commit 61a1bb5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/deps/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ _assign(Deps, {
willFlush = true;
throwFirstError = !! (_opts && _opts._throwFirstError);

var finishedTry = false;
try {
while (pendingComputations.length ||
afterFlushCallbacks.length) {
Expand All @@ -311,11 +312,13 @@ _assign(Deps, {
}
}
}
} catch (e) {
inFlush = false; // needed before calling `Deps.flush()` again
Deps.flush({_throwFirstError: false}); // finish flushing
throw e;
finishedTry = true;
} finally {
if (! finishedTry) {
// we're erroring
inFlush = false; // needed before calling `Deps.flush()` again
Deps.flush({_throwFirstError: false}); // finish flushing
}
willFlush = false;
inFlush = false;
}
Expand Down

0 comments on commit 61a1bb5

Please sign in to comment.