print error more descriptive
This commit is contained in:
parent
c67cbb31f2
commit
866c9f95d3
|
@ -23,7 +23,7 @@ module GitHubChangelogGenerator
|
||||||
@logger.formatter = proc do |_severity, _datetime, _progname, msg|
|
@logger.formatter = proc do |_severity, _datetime, _progname, msg|
|
||||||
"#{msg}\n"
|
"#{msg}\n"
|
||||||
end
|
end
|
||||||
github_options = { per_page: PER_PAGE_NUMBER }
|
github_options = {per_page: PER_PAGE_NUMBER}
|
||||||
github_options[:oauth_token] = @github_token unless @github_token.nil?
|
github_options[:oauth_token] = @github_token unless @github_token.nil?
|
||||||
github_options[:endpoint] = options[:github_endpoint] unless options[:github_endpoint].nil?
|
github_options[:endpoint] = options[:github_endpoint] unless options[:github_endpoint].nil?
|
||||||
github_options[:site] = options[:github_endpoint] unless options[:github_site].nil?
|
github_options[:site] = options[:github_endpoint] unless options[:github_site].nil?
|
||||||
|
@ -60,6 +60,21 @@ module GitHubChangelogGenerator
|
||||||
tags = []
|
tags = []
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
github_fetch_tags(tags)
|
||||||
|
rescue Github::Error::Unauthorized => e
|
||||||
|
@logger.error e.body.red
|
||||||
|
@logger.error "Error: wrong github token provided".red
|
||||||
|
rescue Github::Error::Forbidden => e
|
||||||
|
@logger.warn e.body.red
|
||||||
|
unless @options[:token].nil?
|
||||||
|
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tags
|
||||||
|
end
|
||||||
|
|
||||||
|
def github_fetch_tags(tags)
|
||||||
response = @github.repos.tags @options[:user], @options[:project]
|
response = @github.repos.tags @options[:user], @options[:project]
|
||||||
page_i = 0
|
page_i = 0
|
||||||
count_pages = response.count_pages
|
count_pages = response.count_pages
|
||||||
|
@ -76,12 +91,6 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
elsif @options[:verbose]
|
elsif @options[:verbose]
|
||||||
@logger.info "Found #{tags.count} tags"
|
@logger.info "Found #{tags.count} tags"
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue
|
|
||||||
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
|
||||||
end
|
|
||||||
|
|
||||||
tags
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# This method fetch all closed issues and separate them to pull requests and pure issues
|
# This method fetch all closed issues and separate them to pull requests and pure issues
|
||||||
|
@ -108,6 +117,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
break if @options[:max_issues] && issues.length >= @options[:max_issues]
|
break if @options[:max_issues] && issues.length >= @options[:max_issues]
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
|
puts e.message
|
||||||
|
puts e.backtrace.inspect
|
||||||
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user