|
| 1 | +{% extends "layouts/main.html" %} |
| 2 | + |
| 3 | +{% block pageTitle %} |
| 4 | + Error {% if serviceName %}– {{ serviceName }}{% endif %} – GOV.UK Prototype Kit |
| 5 | +{% endblock %} |
| 6 | + |
| 7 | +{% block content %} |
| 8 | + |
| 9 | + <div class="govuk-grid-row"> |
| 10 | + <div class="govuk-grid-column-full"> |
| 11 | + <h1 class="govuk-heading-l">There is an error</h1> |
| 12 | + |
| 13 | + {% if error.filePath %} |
| 14 | + <p class="govuk-prototype-kit-error-info"> |
| 15 | + <strong>File:</strong> <span id="govuk-prototype-kit-error-file">{{ error.filePath }} {% if error.line %}(line {{ error.line }}){% endif %}</span> |
| 16 | + </p> |
| 17 | + {% endif %} |
| 18 | + |
| 19 | + <p class="govuk-prototype-kit-error-info"> |
| 20 | + <strong>Error:</strong> <span id="govuk-prototype-kit-error-message">{{ error.message }}</span> |
| 21 | + </p> |
| 22 | + |
| 23 | + {% if error.sourceCode %} |
| 24 | + <pre tabindex="0" class="govuk-prototype-kit-error-code govuk-!-margin-bottom-5" id="govuk-prototype-kit-error-block"><code>{{ error.sourceCode.before }}</code><br><code id="govuk-prototype-kit-error-line">{{ error.sourceCode.error }}</code><br><code>{{ error.sourceCode.after }}</code></pre> |
| 25 | + {% endif %} |
| 26 | + |
| 27 | + <div id="govuk-prototype-kit-show-error-button-container" hidden> |
| 28 | + <button id="govuk-prototype-kit-show-error-button" class="govuk-button govuk-button--secondary govuk-!-margin-bottom-1" data-module="govuk-button" aria-expanded="false" aria-controls="govuk-prototype-kit-error-stack"> |
| 29 | + Show full error |
| 30 | + </button> |
| 31 | + </div> |
| 32 | + |
| 33 | + <pre tabindex="0" id="govuk-prototype-kit-error-stack" class="govuk-prototype-kit-error-code js-hidden"><code>{{ error.errorStack }}</code></pre> |
| 34 | + |
| 35 | + <p class="govuk-body govuk-!-margin-top-5"> |
| 36 | + <a class="govuk-link" href="https://www.register-dynamics.co.uk/contact">Get support</a> |
| 37 | + </p> |
| 38 | + |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + |
| 42 | + |
| 43 | +{% endblock %} |
| 44 | + |
| 45 | + |
| 46 | +{% block footer %} |
| 47 | + {{ govukFooter({}) }} |
| 48 | +{% endblock %} |
| 49 | + |
| 50 | + |
| 51 | +{% block pageScripts %} |
| 52 | +<script> |
| 53 | + ;(() => { |
| 54 | + const toggleErrorStack = (event) => { |
| 55 | + const button = event.target |
| 56 | + const isExpanded = button.getAttribute('aria-expanded') === 'true' |
| 57 | + const newState = isExpanded ? 'false' : 'true' |
| 58 | + const newText = isExpanded ? 'Show full error' : 'Hide full error' |
| 59 | + button.setAttribute('aria-expanded', newState) |
| 60 | + button.textContent = newText |
| 61 | +
|
| 62 | + const element = document.getElementById('govuk-prototype-kit-error-stack') |
| 63 | + element.classList.toggle('js-hidden') |
| 64 | + } |
| 65 | +
|
| 66 | + document.getElementById('govuk-prototype-kit-show-error-button-container').hidden = false |
| 67 | +
|
| 68 | + document.getElementById('govuk-prototype-kit-show-error-button') |
| 69 | + .addEventListener('click', toggleErrorStack) |
| 70 | + })() |
| 71 | +</script> |
| 72 | +{% endblock %} |
0 commit comments