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
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ 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::ServerError, with: :api_error
rescue_from Octokit::AccountSuspended, with: :github_suspended_error

def current_user
return unless logged_in?
Expand Down Expand Up @@ -62,4 +64,8 @@ def api_error(error)
def github_unauthorized_error
render 'pages/github_unauthorized_error', status: :unauthorized
end

def github_suspended_error
render 'pages/github_suspended_error', status: :forbidden
end
end
32 changes: 32 additions & 0 deletions app/views/pages/github_suspended_error.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="section">
<div class="container">
<div class="details">

<h1 class="title is-1">Something went wrong when talking to GitHub...</h1>
<p>
It looks like your GitHub account has been suspended.
</p>

<br/>
<br/>
<div class="line-br is-hidden-touch">
<span class="line-br-1">-</span>
<span class="line-br-2">-</span>
</div>
<br/>

<h3 class="title is-3">
Here's what you should try doing to see if we can get this sorted:
</h3>

<p>
<span class="highlight">●</span> <a href="https://support.github.com/contact">Create a support ticket</a>.
</p>
<p>
<span class="highlight">●</span> If the problem persists, please let us know by emailing
<a href="mailto:hacktoberfest@digitalocean.com">hacktoberfest@digitalocean.com</a>.
</p>

</div>
</div>
</div>