Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spaceship] Add language name in stack trace when localization operations fail #20581

Conversation

ccaruceru
Copy link
Contributor

@ccaruceru ccaruceru commented Aug 21, 2022

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary. (not required)

Motivation and Context

Resolves #20336

Description

When executing fastlane deliver and uploading localizations and screenshots there is no way of knowing which language is the one that failed any of the App Store validations. This change adds an additional error with a message about which locale failed to update.

Testing Steps

  1. do a fastlane deliver init on any app (preferably one for testing purposes)
  2. change any of the metadata/<language>/ txt files to fail Apple app info requirements
    • e.g. use an existing app name from App Store in name.txt or add text longer than 30 characters in subtitle.txt
  3. run fastlane deliver
Sample errors before

using an existing app name from another account:

#<Thread:0x00000001053a3648@/Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/fastlane_core/lib/fastlane_core/queue_worker.rb:37 run> terminated with exception (report_on_exception is true):
/Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/api_client.rb:204:in `handle_response': The provided entity includes an attribute with a value that has already been used on a different account. - The app name you entered is already being used. If you have trademark rights to this name and would like it released for your use, submit a claim. - /data/attributes/name (Spaceship::UnexpectedResponse)
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/api_client.rb:135:in `patch'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/tunes/tunes.rb:730:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/2.6.0/forwardable.rb:230:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:34:in `update'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start'

using an existing app name from your account:

#<Thread:0x00000001366c1f38@/Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/fastlane_core/lib/fastlane_core/queue_worker.rb:37 run> terminated with exception (report_on_exception is true):
/Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/api_client.rb:204:in `handle_response': The provided entity includes an attribute with a value that has already been used on this account. - The app name you entered is already being used for another app in your account. If you would like to use the name for this app you will need to submit an update to your other app to change the name, or remove it from App Store Connect. - /data/attributes/name (Spaceship::UnexpectedResponse)
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/api_client.rb:135:in `patch'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/tunes/tunes.rb:730:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/2.6.0/forwardable.rb:230:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:34:in `update'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start

using a subtitle longer than 30 characters:

#<Thread:0x0000000147787fb0@/Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/fastlane_core/lib/fastlane_core/queue_worker.rb:37 run> terminated with exception (report_on_exception is true):
/Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/api_client.rb:204:in `handle_response': An attribute value is too long. - 'subtitle' cannot be longer than '30' characters. - /data/attributes/subtitle (Spaceship::UnexpectedResponse)
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/api_client.rb:135:in `patch'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/tunes/tunes.rb:730:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/2.6.0/forwardable.rb:230:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:34:in `update'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/fastlane-2.209.0/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start'
Sample errors after

using an existing app name from another account:

#<Thread:0x0000000104163910@/Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:37 run> terminated with exception (report_on_exception is true):
/Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:37:in `rescue in update': en-US (Spaceship::AppStoreLocalizationError)
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:32:in `update'
	from /Users/cristian/git/fastlane/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start'
/Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/api_client.rb:204:in `handle_response': The provided entity includes an attribute with a value that has already been used on a different account. - The app name you entered is already being used. If you have trademark rights to this name and would like it released for your use, submit a claim. - /data/attributes/name (Spaceship::UnexpectedResponse)
An attribute value is too long. - 'subtitle' cannot be longer than '30' characters. - /data/attributes/subtitle
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/api_client.rb:135:in `patch'
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/tunes/tunes.rb:730:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/2.6.0/forwardable.rb:230:in `patch_app_info_localization'
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:35:in `update'
	from /Users/cristian/git/fastlane/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start'

[!] An exception occurred for locale: en-US. Check the localization requirements here: https://help.apple.com/app-store-connect/en.lproj/static.html#dev354659071

using an existing app name from your account:

#<Thread:0x00000001169bf520@/Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:37 run> terminated with exception (report_on_exception is true):
/Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:37:in `rescue in update': en-US (Spaceship::AppStoreLocalizationError)
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:32:in `update'
	from /Users/cristian/git/fastlane/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start'
/Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/api_client.rb:204:in `handle_response': The provided entity includes an attribute with a value that has already been used on this account. - The app name you entered is already being used for another app in your account. If you would like to use the name for this app you will need to submit an update to your other app to change the name, or remove it from App Store Connect. - /data/attributes/name (Spaceship::UnexpectedResponse)
An attribute value is too long. - 'subtitle' cannot be longer than '30' characters. - /data/attributes/subtitle
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/api_client.rb:135:in `patch'
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/tunes/tunes.rb:730:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/2.6.0/forwardable.rb:230:in `patch_app_info_localization'
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:35:in `update'
	from /Users/cristian/git/fastlane/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start'

[!] An exception occurred for locale: en-US. Check the localization requirements here: https://help.apple.com/app-store-connect/en.lproj/static.html#dev354659071

using a subtitle longer than 30 characters:

#<Thread:0x00000001178997d0@/Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:37 run> terminated with exception (report_on_exception is true):
/Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:37:in `rescue in update': en-US (Spaceship::AppStoreLocalizationError)
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:32:in `update'
	from /Users/cristian/git/fastlane/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start'
/Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/api_client.rb:204:in `handle_response': An attribute value is too long. - 'subtitle' cannot be longer than '30' characters. - /data/attributes/subtitle (Spaceship::UnexpectedResponse)
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/api_client.rb:135:in `patch'
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/tunes/tunes.rb:730:in `patch_app_info_localization'
	from /Users/cristian/.rbenv/versions/2.6.8/lib/ruby/2.6.0/forwardable.rb:230:in `patch_app_info_localization'
	from /Users/cristian/git/fastlane/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb:35:in `update'
	from /Users/cristian/git/fastlane/deliver/lib/deliver/upload_metadata.rb:218:in `block in upload'
	from /Users/cristian/git/fastlane/fastlane_core/lib/fastlane_core/queue_worker.rb:40:in `block (2 levels) in start'

[!] An exception occurred for locale: en-US. Check the localization requirements here: https://help.apple.com/app-store-connect/en.lproj/static.html#dev354659071

@ccaruceru
Copy link
Contributor Author

@joshdholtz would you/someone like to have a look at this one? it's just a small QOL improvement 🙂

@ccaruceru
Copy link
Contributor Author

maybe @getaaron can have a quick look at this one? 🙏🏻

@vanniktech
Copy link
Contributor

I just ran into this again. Would really like this to be merged and shipped. Gentle push

@ccaruceru
Copy link
Contributor Author

@revolter can you help us with this review? 🙏🏻

@getaaron
Copy link
Collaborator

This looks good to me. Two questions:

Let me know what you think. And thanks for the PR!

@revolter
Copy link
Collaborator

I vote yes for both of Aaron's points.

And I think that the custom error class should go into the https://github.com/fastlane/fastlane/blob/master/spaceship/lib/spaceship/errors.rb file 🤔

@ccaruceru
Copy link
Contributor Author

Thank you for the suggestions! Added a couple of error classes with some extra links in the error message for pointing out the Apple docs in case of failure 📓

Copy link
Collaborator

@revolter revolter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😁

@ccaruceru
Copy link
Contributor Author

@getaaron addressed the suggestions you mentioned. Can you have a 👀 ?

@getaaron
Copy link
Collaborator

Looks awesome! Thanks so much for your work on this.

@getaaron getaaron merged commit e161ef7 into fastlane:master Feb 14, 2023
@ccaruceru ccaruceru deleted the fix/deliver-add-lang-in-error-message-for-meta-upload branch February 14, 2023 20:20
@vanniktech
Copy link
Contributor

Thanks for finally merging it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better exception message when localizing an iOS app
5 participants