DF-1248: Add error details when previewing a form - #1257
Conversation
tsc --noEmit flagged three issues in the drift-canary test: a delete on a required (non-optional) list property, and two mockResolvedValue calls where the fixture's widened engine: string type didn't match FormDefinition's Engine enum. Swap the delete for Reflect.deleteProperty and cast the fixtures through unknown at the two call sites, matching the existing pattern used elsewhere in the repo (e.g. save-and-exit.js).
9a44b85 to
c86eb33
Compare
| "canYou": "You can:", | ||
| "tryBack": "try your browser back button as your data may be saved", | ||
| "contact": "<a class=\"govuk-link\" href=\"https://www.gov.uk/guidance/contact-defra\">contact the Defra Helpline</a> if you have any questions" | ||
| }, |
There was a problem hiding this comment.
You seem to have omitted the translations for the cy.json file. Since the error pages now (always) have a language selector - irrespective of whether the form has translations or not - we will need the Welsh translations for this page.
There was a problem hiding this comment.
I actually left them off intentionally since this is for internal workers only, the language toggle will display but it won't do anything and will fall back to English. We don't actually need Welsh here.
There was a problem hiding this comment.
Would it be sensible to hide the language selector then on the error details page? That would just be a case of removing 'languages' from the viewModel, I think
|
|
||
| const text = parts.join('\n') | ||
|
|
||
| return text.length > MAX_TECHNICAL_LENGTH |
There was a problem hiding this comment.
The ellipsis can be done purely using CSS in the UI but I guess physically truncating the payload here is the correct approach to prevent bleed.
| */ | ||
| function buildDefinitionCauses(joiError) { | ||
| return [ | ||
| ...new Set( |
| "@hapi/wreck": "^18.1.2", | ||
| "@hapi/yar": "^11.0.3", | ||
| "@types/humanize-duration": "^3.27.4", | ||
| "accessible-autocomplete": "^3.0.1", |
There was a problem hiding this comment.
We shouldn't need to include accessible-autocomplete here. It's only when using npm link that it disappears (so I manually copy from plugin node-modules to runner node_modules temporarily). When using a proper plugin npm version, accessible-autocomplete is pulled in from plugin, and therefore not needed in the runner package.json
There was a problem hiding this comment.
Oops, thanks. Accidental commit from development.
f77aad8 to
d6b1d63
Compare
|



This PR depends on DEFRA/forms-engine-plugin#459.
When a form is broken, the error page currently displays a standard HTTP 500 page. This PR introduces an error page specifically for form previews to tell the form designer what is broken.
This page is only shown when accessing a preview form. Live submissions will not show it.
This page is only displayed if the error is related to the form definition or form metadata. Standard errors during a preview will show up as the standard HTTP 500 page.
Jira ticket: DF-1248
Invalid form definition
Invalid metadata
Unknown page controllers
Unknown components