I am trying to automate deployments into TestFlight using Fastlane. I want it to continue "on error" even if one of the lanes errors out.
For example, if I run "doall" below and "item1" errors out, I want it to still run "item2" and "item3".
Is this possible, if so how? Thanks!
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
You can use Ruby error handling to do that
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
It's not super beautiful, but that's the best way to do it, if you want to catch errors for each of the lanes.
Ruby
begin
do_something_that_may_cause_error
rescue => ex
# handle error
ensure
# do something that always run like clean up
end
Swift
defer {
// do something that always run like clean up
}
do {
try doSomethingThatMayCauseError()
} catch (error) {
// handle error
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With