diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index c8df5d4b..f6628297 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,3 +1,5 @@
+require 'async'
+require 'async/container'
require 'ipaddr'
class ApplicationController < ActionController::Base
@@ -20,6 +22,11 @@ class ApplicationController < ActionController::Base
end
end
+ class AccessDenied < StandardError; end
+ rescue_from AccessDenied, with: :on_access_denied
+ rescue_from Async::Stop, Async::Container::Terminate,
+ with: :on_request_stopped
+
def authenticate_user!
redirect_to(new_auth_user_session_path) unless user_signed_in?
end
@@ -52,14 +59,15 @@ class ApplicationController < ActionController::Base
raise ActionController::RoutingError.new("#{record_name} not found")
end
- class AccessDenied < StandardError;end
-
- rescue_from AccessDenied, :with => :on_access_denied
-
def on_access_denied
render file: 'public/403.html', layout: false, status: :forbidden
end
+ def on_request_stopped
+ render file: 'public/stopped.html', layout: false,
+ status: :internal_server_error
+ end
+
def redirect_back!(default=:back)
redirect_to(params[:return_to] || default)
end
diff --git a/public/stopped.html b/public/stopped.html
new file mode 100644
index 00000000..7daeca1e
--- /dev/null
+++ b/public/stopped.html
@@ -0,0 +1,60 @@
+
+
+
+
+
+ Dress to Impress: Oops, caught in a reboot!
+
+
+
+
+
+
+
Oops, caught in a reboot!
+
+ Oh wow, hi! We're deploying a new version of DTI
+ right now, and your pageload got caught in the
+ middle of the restart process, sorry about this!
+
+
+ Reloading the page now should hopefully get you back where
+ you were going! 🤞
+
+
+
+
+