Skip to content

Commit

Permalink
Fix return empty array when the url for the username is invalid (#577)
Browse files Browse the repository at this point in the history
* return empty array when the url for the username is invalid

* return empty array when there are errors in sprints method
  • Loading branch information
rodrieiz authored Aug 29, 2024
1 parent ac419ff commit 2d34879
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/services/github_client/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def pull_request_events
events.flatten.select { |event| event[:type] == 'PullRequestEvent' }
rescue URI::InvalidURIError, Faraday::ResourceNotFound => exception
handle_exception(exception)
[]
end

private
Expand All @@ -37,7 +38,9 @@ def retrieve_events

def handle_exception(exception)
Honeybadger.notify(exception)
Rails.logger.error(exception)
Rails.logger.error(
"Failed to retrieve pull request events for user #{@username}: #{exception.message}"
)
end
end
end
1 change: 1 addition & 0 deletions app/services/jira_client/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def sprints
@sprints
rescue Faraday::ResourceNotFound, Faraday::ForbiddenError => exception
raised_exception(exception)
[]
end

private
Expand Down

0 comments on commit 2d34879

Please sign in to comment.