IndigoUnited / automaton

Task automation tool built in JavaScript
http://indigounited.com/automaton
MIT License
214 stars 10 forks source link

Support non-fatal errors #40

Closed marcooliveira closed 11 years ago

marcooliveira commented 11 years ago

Following the discussion initiated in https://github.com/IndigoUnited/automaton/commit/48632c51b33e718a73191e5d0861eb4b45923c25#commitcomment-2397444, we should probably allow users to define a fatal: false on the subtask level, which makes that subtask able to fail without killing the whole task, allowing it to proceed to the next subtask.

satazor commented 11 years ago

In addition to this, the task that is being run with fatal: false could know this internally and change its behaviour slightly. For instance, the cp task fails when it encounters a pattern that gave no matches. If cp knew internally that it was being run with fatal: false it could proceed instead. This behaviour could also be achieved by being an option of the task itself. I am just dumping my thoughts.

marcooliveira commented 11 years ago

Yes, I see what you mean. Another option, maybe more flexible, would be to provide in ctx the subtask object (which contains the on, options). If the fatal attribute was there, the task would be able to change its behaviour. This would also be useful for supporting other types of behaviour modifiers, like the parallel running of tasks.

satazor commented 11 years ago

Just for reference, here are the possible ways of an exception to happen:

The first two won't be done due to TMM - too much magic.