Skip to content

Commit

Permalink
Use MoneyHelper branded error pages
Browse files Browse the repository at this point in the history
  • Loading branch information
benlovell committed Jan 9, 2025
1 parent 7d41e55 commit 35226f4
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 420 deletions.
13 changes: 13 additions & 0 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class ErrorsController < ApplicationController
def not_found
render status: :not_found
end

def internal_server_error
render status: :internal_server_error
end

def unprocessable_entity
render status: :unprocessable_entity
end
end
12 changes: 12 additions & 0 deletions app/views/errors/internal_server_error.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="l-constrained l-error">
<h1>We're sorry. Something seems to have gone wrong.</h1>
<p class="l-error__description">This is a problem at our end. Try again later and we will hope to have fixed it.</p>

<section class="l-error__useful-links">
<h2 class="l-error__useful-links-heading">Useful links</h2>
<ul class="l-error__list">
<li class="l-error__list-item"><a class="l-error__link" href="/">Return to the Retirement Advice Directory homepage</a></li>
<li class="l-error__list-item"><a class="l-error__link" href="https://www.moneyhelper.org.uk">Go to the MoneyHelper homepage</a></li>
</ul>
</section>
</div>
12 changes: 12 additions & 0 deletions app/views/errors/not_found.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="l-constrained l-error">
<h1>We're sorry. We can't find that page.</h1>
<p class="l-error__description">Please check the address you entered or try again later and you should be able to find it.</p>

<section class="l-error__useful-links">
<h2 class="l-error__useful-links-heading">Useful links</h2>
<ul class="l-error__list">
<li class="l-error__list-item"><a class="l-error__link" href="/">Return to the Retirement Advice Directory homepage</a></li>
<li class="l-error__list-item"><a class="l-error__link" href="https://www.moneyhelper.org.uk">Go to the MoneyHelper homepage</a></li>
</ul>
</section>
</div>
12 changes: 12 additions & 0 deletions app/views/errors/unprocessable_entity.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="l-constrained l-error">
<h1>We're sorry. We can't process that data.</h1>
<p class="l-error__description">You have entered data that we don't know what to do with, or that we can't process. Please go back and try again later.</p>

<section class="l-error__useful-links">
<h2 class="l-error__useful-links-heading">Useful links</h2>
<ul class="l-error__list">
<li class="l-error__list-item"><a class="l-error__link" href="/">Return to the Retirement Advice Directory homepage</a></li>
<li class="l-error__list-item"><a class="l-error__link" href="https://www.moneyhelper.org.uk">Go to the MoneyHelper homepage</a></li>
</ul>
</section>
</div>
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ module Rad
class Application < Rails::Application
config.load_defaults 5.1

config.exceptions_app = self.routes

config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"

config.active_record.belongs_to_required_by_default = false
Expand Down
4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Rails.application.routes.draw do
devise_for :users

get '/404', to: 'errors#not_found'
get '/500', to: 'errors#internal_server_error'
get '/422', to: 'errors#unprocessable_entity'

if Rails.env.staging?
mount Lockup::Engine, at: '/lockup'
end
Expand Down
140 changes: 0 additions & 140 deletions public/404.html

This file was deleted.

140 changes: 0 additions & 140 deletions public/422.html

This file was deleted.

140 changes: 0 additions & 140 deletions public/500.html

This file was deleted.

0 comments on commit 35226f4

Please sign in to comment.