Skip to content

Commit

Permalink
improve error log
Browse files Browse the repository at this point in the history
  • Loading branch information
freddi-kit committed Sep 10, 2022
1 parent 44bf7aa commit 01a5873
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fastlane_core/lib/fastlane_core/itunes_transporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def additional_upload_parameters

# Generates commands and executes the altool.
class AltoolTransporterExecutor < TransporterExecutor
ERROR_REGEX = /\sNSLocalizedFailureReason\s=\s"+(.+)"/
ERROR_REGEX = /\*\*\* Error:\s+(.+)/

private_constant :ERROR_REGEX

Expand Down Expand Up @@ -217,8 +217,11 @@ def execute(command, hide_output)
@errors << "The call to the altool completed with a non-zero exit status: #{exit_status}. This indicates a failure." unless exit_status.zero?

unless @errors.empty? || @all_lines.empty?
# Print out the last 18 lines, this is key for non-verbose mode
@all_lines.last(18).each do |line|
# Print out the last lines until shows error

This comment has been minimized.

Copy link
@AliSoftware

AliSoftware Sep 10, 2022

Contributor

Wording nitpick: # Print the last lines that appear after the last error from the logs

# If error text is not detected, it will be 20 lines
# This is key for non-verbose mode
error_line_index = @all_lines.each_index.select { |i| ERROR_REGEX.match?(@all_lines[i]) }.last
@all_lines.last(error_line_index.nil? ? 20 : (@all_lines.length - error_line_index + 1)).each do |line|
UI.important("[altool] #{line}")
end
UI.message("Application Loader output above ^")
Expand Down Expand Up @@ -284,7 +287,7 @@ def parse_line(line, hide_output)
unless hide_output
# General logging for debug purposes
unless output_done
UI.verbose("[altool]: #{$1}")
UI.verbose("[altool]: #{line}")

This comment has been minimized.

Copy link
@freddi-kit

freddi-kit Sep 10, 2022

Author Contributor

Ah, sorry. This is small bug fixing

end
end
end
Expand Down

0 comments on commit 01a5873

Please sign in to comment.