问题
I am still learning Rake.
Does Rake has built in support to handle task's error like MSBuild of NANT: if this task failed; execute anoter tasks (rolling back, etc.)
e.g.: in MSBuild they have OnError
element
<OnError ExecuteTargets="RollBackDatabase" />
Thanks for your help
回答1:
Found out the answer:
just use normal exception handling block
task :will_fail_task do
begin
raise "something's wrong here"
rescue
rollback()
raise "error executing task"
end
end
来源:https://stackoverflow.com/questions/4263401/rake-task-error-handling