-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AO3-6911 Add error page for Rack::Timeout::RequestTimeoutException #5074
base: master
Are you sure you want to change the base?
Conversation
f1ec0aa
to
c420089
Compare
I am ignoring the reviewdog comments on single v double quotes as in all instances using single quotes matches the existing page styling or the recommended page to adapt from (re: 500 error page). |
Please do address the reviewdog comments on the parts that you've added or changed. It's fine to deviate from the existing 500 error page in terms of code style. You don't have to fix any of the existing lint violations, however. |
74fd00f
to
165261d
Compare
app/controllers/errors_controller.rb
Outdated
@@ -8,4 +8,8 @@ class ErrorsController < ApplicationController | |||
def auth_error | |||
@page_subtitle = "Auth Error" | |||
end | |||
|
|||
def timeout_error | |||
@page_subtitle = "Timeout Error" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also i18n this. Here is an example:
@page_subtitle = t(".page_title") |
otwarchive/config/locales/controllers/en.yml
Line 100 in 775ed13
page_title: Privacy Policy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Apologies, I am used to a different pattern and did not look carefully enough at the locale specs for this project. I updated auth_error
as well.
config/routes.rb
Outdated
@@ -53,6 +53,7 @@ | |||
get '/422', to: 'errors#422' | |||
get '/500', to: 'errors#500' | |||
get '/auth_error', to: 'errors#auth_error' | |||
get "/timeout", to: "errors#timeout" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to have the name of the controller action in the to
option, and then lets match the auth_error for the get
get "/timeout", to: "errors#timeout" | |
get "/timeout_error", to: "errors#timeout_error" |
The reason the test didn't fail is because by default, even if there is no method in the controller, Rails renders the HTML template with the action name, which is timeout.html.erb
. The html.erb should also be renamed to timeout_error.html.erb
to match the controller (and the auth error).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tricky, I would prefer just a failure than a default loading that is non-obvious. Thanks for pointing it out, resolved.
Co-authored-by: Bilka <[email protected]>
69978a8
to
a51bd9b
Compare
a51bd9b
to
d507d2a
Compare
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-1234 Fix thing
)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-6911
Purpose
/timeout
that is returned should the app controller encounterRack::Timeout::RequestTimeoutException
.auth_error
page is rendered on its route toerrors_controller_spec.rb
Testing Instructions
Needs Systems change, see story for details
I added a unit test that this page can be routed too, but I do not think there is a way to test the actual timeout rescue except from an integration test. See the docs here. If I'm missing something or if we have a method for setting up such tests already that someone could point me too it would be much appreciated.
Credit
unsafe-deref, he/him