yahoo/mojito — pull request #978 by caridy (2013-02-12 23:11:52+00:00)
Title: Fix for issue #865: composite addon error manipulation

An important child fails thru a call to `ac.error`, as a result, the parent should also fail. For this use-case, we are proposing a flag at the child level configuration:

```
{
"type": "ParentMojit",
"config": {
"children": {
"slot1": {
"type": "ReallyImportant",
"propagateFailure": true,
"config": {}
},
"slot2": {
"type": "NotImportant",
"propagateFailure": false,
"config": {}
},
"slot3": {
"type": "NotSoImportantWithDefaultSetting",
"config": {}
}
}
}
}
```

In the example above, `slot1` and `slot3` can fail, in which case the data passed into the parent view will be an empty string. And that's the default behavior. In the other hand, if the mojit in `slot2` fails, the error will be propagated, and `ParentMojit` will also fail by calling `ac.error()` and piping the original error from child on `slot2` due to the special configuration `propagateFailure`, which is set to `true`. This give us the control needed to define important childs.

TODO:

* Fast failure: Instead of waiting for all children to then report the error, we should report the error as soon as it happens if the child is marked as important thru the `propagateFailure` flag.

* Document/Prototype alternative mojits as a potential solution for error propagations.