Content
Error pages
Provide users with clear and helpful error pages when something goes wrong.
Contents
Provide the user with information about the error:
- Error type
- A very short description of the error in present tense such as "Page not found"
- Error details (optional)
- More details about why the error may have occured
- Suggested next steps
- Some possible next steps that the user can take to either access the content they want or report the issue
Test all links and buttons to make sure they work. Remember to do the hard work to make it simple.
Some of the main types of error page are:
A complete list of responses that are available for error pages can be found on MDN - HTTP response status codes.
Page not found
HTML
<h1 class="tna-heading-xl">Page not found</h1>
<p>If you typed the web address, check it is correct.</p>
<p>If you pasted the web address, check you copied the entire address.</p>
<p>If the web address is correct or you selected a link or button, <a href="https://www.nationalarchives.gov.uk/contact-us/">contact us</a> to let us help.</p>
Use a page not found error if someone is trying to view a page that does not exist. This happens if someone:
- selects a link or button that takes them to a page that does not exist
- types or copies a web address for a page that does not exist
- types or copies a web address incorrectly
The server should also return a 404 response for this page.
Restricted access
HTML
<h1 class="tna-heading-xl">Restricted</h1>
<p>You are not permitted to view this content.</p>
<p>If you typed the web address, check it is correct.</p>
<p>If you pasted the web address, check you copied the entire address.</p>
<p>If you believe you should be able to view this content, <a href="https://www.nationalarchives.gov.uk/contact-us/">contact us</a> to request access.</p>
Use a restricted access error if someone is trying to view a page or resource that they shouldn’t be allowed to. This can happen if:
- the user is not known (unauthenticated)
- the user is known but not allowed to view (unauthorised)
The server should also return either a 401 (Unauthorized) or 403 (Forbidden) response for this page.
Service issue
HTML
<h1 class="tna-heading-xl">There is a problem with the service</h1>
<p>Try again in a few minutes.</p>
<p>If the web address is correct or you selected a link or button, <a href="https://www.nationalarchives.gov.uk/contact-us/">contact us</a> to let us help.</p>
Use a service issue error if someone is trying to view a page that the service is currently unable to render. This can happen if:
- the server is unavailable
- the server experienced an error that wasn’t handled properly
- an unknown issue occured that isn’t covered by other error messages
The server should also return a response code in the 5xx range.
Rate limited
HTML
<h1 class="tna-heading-xl">Too many requests</h1>
<p>You have requested too many resources in a set timeframe.</p>
<p>Try again in a few minutes.</p>
Use a rate limited error if someone makes too many requests to a service.
This error will mainly be aimed at bots and tools that are used to scrape content from the site, often sending enough requests to slow down parts of our system.
Don’t give details on how many requests in a given timeframe will trigger the error or how long until they are able to make more requests.