Class: Fastlane::Helper::TranslationErrorHandler
- Inherits:
-
Object
- Object
- Fastlane::Helper::TranslationErrorHandler
- Defined in:
- lib/fastlane/plugin/translate/helper/translation_error_handler.rb
Class Method Summary collapse
- .handle_batch_result(action, retry_count, max_retries) ⇒ Object
- .handle_rate_limit_error(_batch, batch_index, total_batches) ⇒ Object
- .handle_translation_error(error, _batch, batch_index, total_batches) ⇒ Object
Class Method Details
.handle_batch_result(action, retry_count, max_retries) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fastlane/plugin/translate/helper/translation_error_handler.rb', line 57 def self.handle_batch_result(action, retry_count, max_retries) case action when :retry return :retry if retry_count < max_retries UI.error("❌ Max retries (#{max_retries}) exceeded") :skip when :skip :skip when :quit :quit else :continue end end |
.handle_rate_limit_error(_batch, batch_index, total_batches) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fastlane/plugin/translate/helper/translation_error_handler.rb', line 18 def self.handle_rate_limit_error(_batch, batch_index, total_batches) = ['Wait 60s and retry', 'Skip this batch', 'Abort translation', '❌ Quit'] choice = UI.select("⚠️ Rate limit exceeded for batch #{batch_index + 1}/#{total_batches}", ) case choice when 'Wait 60s and retry' UI.('⏳ Waiting 60 seconds...') sleep(60) :retry when 'Skip this batch' UI.important("⏭️ Skipping batch #{batch_index + 1}") :skip when 'Abort translation' UI.user_error!('❌ Translation aborted by user') when '❌ Quit' :quit end end |
.handle_translation_error(error, _batch, batch_index, total_batches) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fastlane/plugin/translate/helper/translation_error_handler.rb', line 38 def self.handle_translation_error(error, _batch, batch_index, total_batches) UI.error("❌ Translation error for batch #{batch_index + 1}/#{total_batches}: #{error.}") = ['Skip this batch', 'Retry batch', 'Abort translation', '❌ Quit'] choice = UI.select('Choose action:', ) case choice when 'Skip this batch' UI.important("⏭️ Skipping batch #{batch_index + 1}") :skip when 'Retry batch' UI.("🔄 Retrying batch #{batch_index + 1}") :retry when 'Abort translation' UI.user_error!('❌ Translation aborted by user') when '❌ Quit' :quit end end |