Skip to content
Browse files

2.1.4

Fix an instance of errors getting swallowed within nested asyncblocks.
  • Loading branch information...
1 parent 86cb7a3 commit 61166bb318601bd2ba437f737b63bdaf9084f05b @scriby committed
Showing with 11 additions and 6 deletions.
  1. +10 −5 lib/flow.js
  2. +1 −1 package.json
View
15 lib/flow.js
@@ -62,6 +62,11 @@ var callbackHandler = function(self, task){
task.callback = function taskCallback(){
var args = Array.prototype.slice.call(arguments);
+ //Allow the error to be thrown again from an outer asyncblock, even if callbackCalled is true
+ if(task.error){
+ task.error.__asyncblock_handled = false;
+ }
+
if(callbackCalled){
return;
}
@@ -84,6 +89,11 @@ var callbackHandler = function(self, task){
self._finishedTasks[task.key] = task;
}
+ //Allow the error to be thrown again from an outer asyncblock (task.error may not be set until resultHandler is called)
+ if(task.error){
+ task.error.__asyncblock_handled = false;
+ }
+
if(self._light === false) {
task.resultWasAsync = true;
@@ -91,11 +101,6 @@ var callbackHandler = function(self, task){
self._fiber.run(task);
} else {
task.resultWasAsync = false;
-
- //Allow the error to be thrown again from an outer asyncblock
- if(task.error){
- task.error.__asyncblock_handled = false;
- }
}
};
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "asyncblock",
- "version": "2.1.3",
+ "version": "2.1.4",
"description": "A simple and powerful abstraction of node-fibers",
"keywords": [
"fiber", "fibers", "coroutine", "stop", "go", "green", "red" ],

0 comments on commit 61166bb

Please sign in to comment.
Something went wrong with that request. Please try again.