Browse Source

Add too many requests page

pull/356/head
Stéphane Meny 3 years ago
parent
commit
02c7f68b44
No known key found for this signature in database
GPG Key ID: 9D0AFEA988527923
  1. 7
      app/controllers/errors_controller.rb
  2. 8
      app/views/errors/too_many_requests.erb
  3. 1
      config/routes.rb

7
app/controllers/errors_controller.rb

@ -22,4 +22,11 @@ class ErrorsController < ApplicationController
format.json { render json: { error: "Unprocessable entity" }, status: :unprocessable_entity }
end
end
def too_many_requests
respond_to do |format|
format.html { render status: :too_many_requests }
format.json { render json: { error: "Too many requests" }, status: :too_many_requests }
end
end
end

8
app/views/errors/too_many_requests.erb

@ -0,0 +1,8 @@
<% content_for :title, "Sorry, you have sent too many requests to our service" %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l"><%= content_for(:title) %></h1>
<p class="govuk-body">Try again in a minute.</p>
</div>
</div>

1
config/routes.rb

@ -71,6 +71,7 @@ Rails.application.routes.draw do
scope via: :all do
match "/404", to: "errors#not_found"
match "/429", to: "errors#too_many_requests"
match "/422", to: "errors#unprocessable_entity"
match "/500", to: "errors#internal_server_error"
end

Loading…
Cancel
Save