Skip to content

Commit 9d9bc25

Browse files
authored
Public error pages (#117)
1 parent 0005912 commit 9d9bc25

File tree

11 files changed

+88
-342
lines changed

11 files changed

+88
-342
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class PublicPagesController < BaseController
2+
def internal_server_error
3+
respond_to do |format|
4+
format.html { render "public_pages/internal_server_error", status: 500 }
5+
format.any { head 500 }
6+
end
7+
end
8+
9+
def page_not_found
10+
respond_to do |format|
11+
format.html { render "public_pages/page_not_found", status: 404 }
12+
format.any { head 404 }
13+
end
14+
end
15+
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<% content_for :page_title, t("views.public_pages.internal_server_error.title") %>
2+
3+
<div class="main-content-inner">
4+
<section class="slab">
5+
<div class="grid">
6+
<div class="grid__item width-three-fourths">
7+
<div class="main-content-inner">
8+
<h1 class="offboarding--title">
9+
<%= content_for(:page_title) %>
10+
</h1>
11+
12+
<div class="offboarding--help-text">
13+
<p class="h2"><%=t("views.public_pages.internal_server_error.body") %></p>
14+
<p class="h2">
15+
<%=t("views.public_pages.internal_server_error.contact_html", :email_link => mail_to("[email protected]")) %>
16+
</p>
17+
</div>
18+
19+
<div class="buttons--vertical-stack">
20+
<%= link_to root_path, class: "button button--primary button--wide text--centered" do %>
21+
<%=t("general.return_home") %>
22+
<% end %>
23+
</div>
24+
</div>
25+
</div>
26+
</div>
27+
</section>
28+
</div>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<% content_for :page_title, t("views.public_pages.page_not_found.title") %>
2+
<div class="main-content-inner">
3+
<section class="slab">
4+
<div class="grid">
5+
<div class="grid__item width-three-fourths">
6+
<div class="main-content-inner">
7+
<h1 class="offboarding--title">
8+
<%= content_for(:page_title) %>
9+
</h1>
10+
11+
<div class="offboarding--help-text">
12+
<p class="h2">
13+
<%=t("views.public_pages.page_not_found.let_us_know_html", :email_link => mail_to("[email protected]")) %>
14+
</p>
15+
</div>
16+
<div class="buttons--vertical-stack">
17+
<%= link_to t("general.return_home"), root_path, class: "button button--primary button--wide text--centered" %>
18+
</div>
19+
</div>
20+
</div>
21+
</div>
22+
</section>
23+
</div>

config/environments/development.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
# Make code changes take effect immediately without server restart.
77
config.enable_reloading = true
88

9+
# Use pya routes to render server error pages.
10+
config.exceptions_app = routes
11+
912
# Do not eager load code on boot.
1013
config.eager_load = true
1114

config/environments/production.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# Full error reports are disabled.
1313
config.consider_all_requests_local = false
1414

15+
# Use pya routes to render server error pages.
16+
config.exceptions_app = routes
17+
1518
# Turn on fragment caching in view templates.
1619
config.action_controller.perform_caching = true
1720

config/environments/test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
config.consider_all_requests_local = true
2323
config.cache_store = :null_store
2424

25+
# Use pya routes to render server error pages.
26+
config.exceptions_app = routes
27+
2528
# Render exception templates for rescuable exceptions and raise for other exceptions.
2629
config.action_dispatch.show_exceptions = :rescuable
2730

config/locales/en.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ en:
2929
invalid: Incorrect verification code. After 2 failed attempts, accounts are locked.
3030
general:
3131
continue: Continue
32+
return_home: Return to home
3233
submit: Submit
3334
text_message:
3435
verification_code: "Your 6-digit FileYourStateTaxes verification code is: %{verification_code}. This code will expire after 10 minutes"
@@ -98,6 +99,14 @@ en:
9899
return_to_home: Return to Homepage
99100
also_visit_html: You can also visit your state’s tax agency website to request your %{year} tax return. For more information, click on the links below or visit our <a href='https://www.fileyourstatetaxes.org/en/az/faq/how_can_i_access_my_2023_state_tax_return'>FAQ page</a>.
100101
title: Sorry, we were not able to verify your account
102+
public_pages:
103+
internal_server_error:
104+
body: It looks like there was a server error. We've been notified of the issue and will work to fix it!
105+
contact_html: If you’re running into trouble, we’re here for you. You can reach us using the "Help"/"Chat" button in the bottom right or by sending us an email at %{email_link}.
106+
title: Oops, we're sorry, but something went wrong.
107+
page_not_found:
108+
let_us_know_html: If you followed a link here, please let us know using the "Help"/"Chat" button in the bottom right or by sending us an email at %{email_link}.
109+
title: Oops, we're sorry, but the page you're looking for can't be found.
101110
layouts:
102111
header:
103112
link_to_main_content: "Skip to main content"

config/routes.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
# Defines the root path route ("/")
1313
# root "posts#index"
14+
get "/500", to: "public_pages#internal_server_error"
15+
get "/422", to: "public_pages#internal_server_error"
16+
get "/404", to: "public_pages#page_not_found"
17+
1418
scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
1519
root "pages#home"
1620
get "year_select", to: "year_select#show", as: :year_select

public/404.html

Lines changed: 0 additions & 114 deletions
This file was deleted.

public/422.html

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)