Skip to content
This repository was archived by the owner on Mar 29, 2022. It is now read-only.

Add error handling for GitHub 503s #461

Merged
merged 2 commits into from
Aug 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base
before_action :set_current_user
rescue_from Faraday::ClientError, with: :api_error
rescue_from Octokit::Unauthorized, with: :github_unauthorized_error
rescue_from Octokit::ServiceUnavailable, with: :api_error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should recuse from Octokit::ServerError instead, so we cleanly handle all 5xx that GitHub might throw at us?

What do you think about handling other client errors from Octokit, or are we happy to let the app do what it does currently for those until we see an issue arrise?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense to handle all 5xx –– let's do that.

As far as the other errors –– I wish we had more data from last year! Let me at least add Octokit::AccountSuspended, which was mentioned in #431


def current_user
return unless logged_in?
Expand Down