From 103ec477df2f4ec5b7ffdaadd4c77fff787cfa3e Mon Sep 17 00:00:00 2001 From: Kat Juell Date: Wed, 19 Aug 2020 16:53:44 -0400 Subject: [PATCH 1/2] Add octokit::serviceunavailable error handling to application controller --- app/controllers/application_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 94cbda3f2..b777b91c1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 def current_user return unless logged_in? From ac9792c7c293476b5e56d49f8818a10eae20bd13 Mon Sep 17 00:00:00 2001 From: Kat Juell Date: Mon, 24 Aug 2020 10:42:12 -0400 Subject: [PATCH 2/2] Add all 5xx error handling on sign-in and account suspended error handling --- app/controllers/application_controller.rb | 7 +++- .../pages/github_suspended_error.html.erb | 32 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 app/views/pages/github_suspended_error.html.erb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b777b91c1..0a6626bd2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +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::ServiceUnavailable, with: :api_error + rescue_from Octokit::ServerError, with: :api_error + rescue_from Octokit::AccountSuspended, with: :github_suspended_error def current_user return unless logged_in? @@ -63,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 diff --git a/app/views/pages/github_suspended_error.html.erb b/app/views/pages/github_suspended_error.html.erb new file mode 100644 index 000000000..aaf49cc2e --- /dev/null +++ b/app/views/pages/github_suspended_error.html.erb @@ -0,0 +1,32 @@ +
+
+
+ +

Something went wrong when talking to GitHub...

+

+ It looks like your GitHub account has been suspended. +

+ +
+
+
+ - + - +
+
+ +

+ Here's what you should try doing to see if we can get this sorted: +

+ +

+ Create a support ticket. +

+

+ If the problem persists, please let us know by emailing + hacktoberfest@digitalocean.com. +

+ +
+
+