I have a custom Rakefile which calls different file
tasks. Sometimes a file that is expected doesn't exist, and rake throws a RuntimeError and fails. However, I'd like to do a few things before it fails. So is there any way I could rescue a RuntimeError? Or is there some sort of a magic task which gets called before a complete fail?
views:
22answers:
1
+1
A:
I haven't run into this issue with rake myself, but you could try simply wrapping your call to the file
tasks in a begin
-rescue
block, i.e.
begin
file_task
rescue RuntimeError => e
puts e
end
and then do your recuing in the rescue block.
liwp
2010-02-09 13:26:11
Right, I actually forgot I call tasks manually. Thanks :)
squil
2010-02-09 13:39:46