How to continue "by mistake" with Fastlane

I am trying to automate the deployment in TestFlight using Fastlane. I want it to continue β€œin error” even if one of the errors in the tracks is missing.

For example, if I run "doall" below and the errors are "item1", I want it to still execute "item2" and "item3".

Is this possible, if so, how? Thank!

lane :item1 do
 # Do some stuff
end

lane :item2 do
 # Do some stuff
end

lane :item3 do
 # Do some stuff
end

lane :doall do
 item1 # This causes an error
 item2
 item3
end

error do |lane, exception|
 # Send error notification
end
+4
source share
1 answer

You can use Ruby error handling for this

lane :item1 do
 # Do some stuff
end

lane :item2 do
 # Do some stuff
end

lane :item3 do
 # Do some stuff
end

lane :doall do
 begin
   item1 # This causes an error
 rescue => ex
   UI.error(ex)
 end
 begin
   item2
 rescue => ex
   UI.error(ex)
 end
 begin
   item3
 rescue => ex
   UI.error(ex)
 end
end

error do |lane, exception|
 # Send error notification
end

This is not very beautiful, but it is the best way to do this if you want to catch errors for each of the bands.

+10
source

All Articles