Fail on service exceptions, i.e. HTTP 5xx errors

Before, the lane would have just swallowed this error. It would have printed it, but still treated the call as a success.
Now, it will fail execution on a service error, i.e. when this is caused by a service outage, to signal the lane did not succeed.
This commit is contained in:
Matthias Wenz 2019-06-21 14:55:20 -07:00
Родитель 74d304dc7f
Коммит ca5d4948eb
2 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -48,6 +48,8 @@ module Fastlane
when 404
UI.error("Not found, invalid owner or application name")
false
when 500..
UI.crash!("Internal Service Error, please try again later")
else
UI.error("Error #{response.status}: #{response.body}")
false

Просмотреть файл

@ -275,6 +275,24 @@ describe Fastlane::Actions::AppcenterUploadAction do
end.to raise_error("No or incorrect destination type given. Use 'group' or 'store'")
end
it "handles external service response and fails" do
expect do
stub_check_app(200)
stub_create_release_upload(500)
Fastlane::FastFile.new.parse("lane :test do
appcenter_upload({
api_token: 'xxx',
owner_name: 'owner',
app_name: 'app',
apk: './spec/fixtures/appfiles/apk_file_empty.apk',
destinations: 'Testers',
destination_type: 'group'
})
end").runner.execute(:test)
end.to raise_error("Internal Service Error, please try again later")
end
it "handles upload build error" do
stub_check_app(200)
stub_create_release_upload(200)