Skip to content

Commit

Permalink
Handle errors when linking board.
Browse files Browse the repository at this point in the history
  • Loading branch information
ticean authored and rauhryan committed May 13, 2012
1 parent da1e936 commit 57885b9
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions stint/stint/lib/stint/pebble.rb
Expand Up @@ -31,18 +31,23 @@ def board(user_name, repo)
.each do |l|
match = @link_pattern.match l["name"]
user, repo = match[:user_name], match[:repo]
linked_board = build_board user, repo
next if linked_board[:labels].size != board[:labels].size
board[:labels].each_with_index do |label, index|

linked_issues = linked_board[:labels][index][:issues].map do |i|
i["repo"][:color] = l["color"]
i
end

label[:issues] = label[:issues].concat(linked_issues).sort_by { |i| i["_data"]["order"] || i["number"].to_f}
begin
linked_board = build_board user, repo
next if linked_board[:labels].size != board[:labels].size
board[:labels].each_with_index do |label, index|

linked_issues = linked_board[:labels][index][:issues].map do |i|
i["repo"][:color] = l["color"]
i
end

label[:issues] = label[:issues].concat(linked_issues).sort_by { |i| i["_data"]["order"] || i["number"].to_f}
end
board[:milestones].concat(linked_board[:milestones]).sort_by { |m| m["_data"]["order"] || m["number"].to_f}

rescue
puts "Warning: Unable to link board: #{user}, #{repo}"
end
board[:milestones].concat(linked_board[:milestones]).sort_by { |m| m["_data"]["order"] || m["number"].to_f}

end
return board
Expand Down

0 comments on commit 57885b9

Please sign in to comment.