Show custom error page when welsh form is archived#1969
Conversation
f2a79ec to
97d2a06
Compare
The `find` method in `FormDocumentService` was implemented to throw an `ActiveResource::ResourceNotFound` error if the form wasn't found, or if the form_id was in an invalid format. This meant that methods using `find` would have to implement their own error handling logic, which can become repetitive and less readable in methods with multiple calls to `find`. This commit updates the method to rescue the error and return `nil` if the form can't be found.
5068575 to
450db42
Compare
thomasiles
left a comment
There was a problem hiding this comment.
This looks neat and works for me locally.
Showing the archived welsh page does mean 4 API calls to the admin. I've left a suggestion but I don't know that its any better or if its something worth bothering about. If we did want to optimise it in the future, I guess changing the API to let the runner know what state the form is in might be better.
Reorganises the code to prevent us fetching the live English form from the API twice. Co-authored-by: Thomas Iles <tom.iles@digital.cabinet-office.gov.uk>
We generally aim to keep page titles in sync with the main heading on the page - this makes it easier for screen reader users to understand what page they're on as they navigate through a form.
14b71f3 to
083ca68
Compare
|
|
🎉 A review copy of this PR has been deployed! It is made of up two components Important Not all of the functionality of forms-runner is present in review apps. You should use the full dev environment to test the functionality which is disabled here. It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |



What problem does this pull request solve?
Trello card: https://trello.com/c/KGHod5dY/2856-iterate-the-404-page-for-archived-welsh-forms
Adds a new page to show users a specific error message when a form is no longer available in Welsh. It will display when:
As part of this, there's a small refactor which makes the FormDeocumentRepository return
nilinstead of throwing an error if no form document is found. This makes it easier to use the repository'sfindmethod to check the existence of a form document without adding repetitive error handling.Things to consider when reviewing