Automation “如何继续”;“论错误”;使用快车道
我正在尝试使用Fastlane将部署自动化到TestFlight中。我希望它继续“出错”,即使其中一条车道出错 例如,如果我运行下面的“doall”和“item1”错误,我希望它仍然运行“item2”和“item3” 这可能吗?如果可能,怎么可能?谢谢Automation “如何继续”;“论错误”;使用快车道,automation,fastlane,Automation,Fastlane,我正在尝试使用Fastlane将部署自动化到TestFlight中。我希望它继续“出错”,即使其中一条车道出错 例如,如果我运行下面的“doall”和“item1”错误,我希望它仍然运行“item2”和“item3” 这可能吗?如果可能,怎么可能?谢谢 lane :item1 do # Do some stuff end lane :item2 do # Do some stuff end lane :item3 do # Do some stuff end lane :doall
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
您可以使用Ruby错误处理来做到这一点
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
这不是非常漂亮,但如果你想捕捉每条车道的错误,这是最好的方法。Ruby
begin
do_something_that_may_cause_error
rescue => ex
# handle error
ensure
# do something that always run like clean up
end
迅捷的
@KrauseFx的swift等价物是什么。i、 我如何在fastfile.swift中实现它?寻找
finally
块?使用确保!最终尝试捕获的Ruby模拟是begin rescue
defer {
// do something that always run like clean up
}
do {
try doSomethingThatMayCauseError()
} catch (error) {
// handle error
}