module Guard
def run_supervised_task(guard, task, *args)
-
(:task_has_failed)- when task has failed
Parameters:
-
args(Array) -- the arguments for the task -
task(Symbol) -- the task to run -
guard(Guard::Guard) -- the Guard to execute
def run_supervised_task(guard, task, *args) catch guard_symbol(guard) do guard.hook("#{ task }_begin", *args) result = guard.send(task, *args) guard.hook("#{ task }_end", result) result end rescue Exception => ex UI.error("#{ guard.class.name } failed to achieve its <#{ task.to_s }>, exception was:" + "\n#{ ex.class }: #{ ex.message }\n#{ ex.backtrace.join("\n") }") guards.delete guard UI.info("\n#{ guard.class.name } has just been fired") ex end