Skip to content

Commit

Permalink
Failed to recover from a time out error #2
Browse files Browse the repository at this point in the history
Added proper error handling to the driver. Now the driver will complain if something go wrong with trello connections.
  • Loading branch information
ronflima committed Apr 6, 2016
1 parent 3920700 commit 32f1479
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions lib/time_trello/trello_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,37 @@ def parser

# Public: Getter. Gets a board, based on a board id.
def board
@board = Trello::Board.find(@board_id) if @board.nil?
retried = false

begin
@board = Trello::Board.find(@board_id) if @board.nil?
rescue
if !retried
retried = true
retry
else
raise "Failed to connect to Trello API"
end
end

@board
end

# Public: Getter. Gets all members subscribed to the board under analysis
def members
@members = self.board.members if @members.nil?
retried = false

begin
@members = self.board.members if @members.nil?
rescue
if !retried
retried = true
retry
else
raise "Failed to connect to Trello API"
end
end

@members
end

Expand Down

0 comments on commit 32f1479

Please sign in to comment.