Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "fluorine", | ||
"main": "fluorine.js", | ||
"version": "1.0.0", | ||
"version": "1.0.4", | ||
"homepage": "https://github.com/freshout-dev/fluorine", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -272,2 +272,5 @@ /** | ||
this.parent.dispatch(this.name); | ||
this.parent.dispatch('reject', { | ||
data : { node : this, error: error } | ||
}); | ||
}, | ||
@@ -274,0 +277,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "Fluorine node Package to run js flows better than promises", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type" : "git", |
Fluorine | ||
======== | ||
[](https://www.npmjs.com/package/fluorine) | ||
 | ||
@@ -41,6 +43,6 @@ Fluorine - Flow based programing abstraction. | ||
Then you add a step to the flow. | ||
Any step can have other steps as dependancies. | ||
Any step can have other steps as dependencies. | ||
When the program runs, it will run each step only if all of its | ||
dependancies have been met. | ||
dependencies have been met. | ||
@@ -111,2 +113,3 @@ Dependencies/Requirements | ||
Using Fluorine | ||
```javascript | ||
@@ -177,1 +180,30 @@ var f = new Flow({name: 'testFlow'}); | ||
``` | ||
Error handling | ||
-------------- | ||
If you want to handle errors in the execution of one of your nodes, you can | ||
pass an additional function parameter to the step execution, that will be | ||
called in case of error. | ||
To trigger an error, you must explicitely call `step.fail(error)` for other | ||
nodes to be notified | ||
```javascript | ||
var f = new Flow({ name : 'flow' }) | ||
f.step('foo')(function(step) { | ||
step.success(); | ||
}); | ||
f.step('bar')(function(step) { | ||
errorData = { error : 'some' }; | ||
step.fail(errorData); | ||
}); | ||
f.step('baz').dependsOn('foo', 'bar')(function(step) { | ||
// This won't be executed | ||
}, function(step) { | ||
console.log("Error: ", step.errors.bar); | ||
}); | ||
``` |
17441
283
206