Skip to content

Commit

Permalink
Add page for 429 errors
Browse files Browse the repository at this point in the history
This adds an error page which users are seen if they receive a 429
error, meaning they've triggered our rate limiting checks.

This was missed in f225a5a.
  • Loading branch information
thomasleese committed Jun 28, 2022
1 parent da2513a commit 270325c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
class ErrorsController < ApplicationController
skip_before_action :verify_authenticity_token

Expand All @@ -10,6 +9,10 @@ def unprocessable_entity
render "unprocessable_entity", status: :unprocessable_entity
end

def too_many_requests
render "too_many_requests", status: :too_many_requests
end

def internal_server_error
render "internal_server_error", status: :internal_server_error
end
Expand Down
19 changes: 19 additions & 0 deletions app/views/errors/too_many_requests.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<%= content_for :page_title, "Sorry, there’s a problem with the service" %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">Sorry, there’s a problem with the service</h1>

<p class="govuk-body">Try again later.</p>

<p class="govuk-body">
You’re seeing this message as you’ve tried to access this page repeatedly,
please wait a few moments before trying again.
</p>

<p class="govuk-body">
If you have any questions, please email us at
<a class="govuk-link" href="mailto:<%= t('service.email') %>"><%= t('service.email') %></a>.
</p>
</div>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
scope via: :all do
get "/404", to: "errors#not_found"
get "/422", to: "errors#unprocessable_entity"
get "/429", to: "errors#too_many_requests"
get "/500", to: "errors#internal_server_error"
end

Expand Down

0 comments on commit 270325c

Please sign in to comment.