Skip to content

Commit 76bc90d

Browse files
authored
Merge pull request #1147 from digital-land/errorDetail-template-bug
Remove Error Detail from showing from Async Service.
2 parents 754d15e + 571afad commit 76bc90d

2 files changed

Lines changed: 8 additions & 13 deletions

File tree

src/controllers/resultsController.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ export async function getRequestDataMiddleware (req, res, next) {
7272

7373
export async function checkForErroredResponse (req, res, next) {
7474
if (req.locals.requestData.response?.error) {
75-
const { errMsg, errMsgDetail } = req.locals.requestData.response.error
75+
const { errMsg } = req.locals.requestData.response.error
7676
if (errMsg && errMsg.length > 0) {
77-
return next(new MiddlewareError(errMsg, 500, { template: 'check/error-redirect.html', errorDetail: errMsgDetail }))
77+
return next(new MiddlewareError(errMsg, 500, { template: 'check/error-redirect.html' }))
7878
} else {
79-
return next(new MiddlewareError('An unknown error occured when processing your endpoint', 500, { template: 'check/error-redirect.html' }))
79+
return next(new MiddlewareError('An unknown error occurred when processing your endpoint', 500, { template: 'check/error-redirect.html' }))
8080
}
8181
}
8282
next()

src/views/check/error-redirect.html

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
{% endblock %}
99

1010
{% block content %}
11+
{% set errorMessage = err.message | default("An error occurred, please try again later.", true) %}
1112
{{ govukErrorSummary({
1213
titleText: "There’s a problem",
1314
errorList: [
1415
{
15-
text: err.message,
16+
text: errorMessage,
1617
href: "#bad-upload"
1718
}
1819
]
@@ -21,7 +22,7 @@
2122
<div class="govuk-grid-row">
2223
<div class="govuk-grid-column-two-thirds">
2324
{# Display specific error details for certain errors else show detail if available #}
24-
{% if err.message == "SSL certificate verification failed" %}
25+
{% if errorMessage == "SSL certificate verification failed" %}
2526
<p class="govuk-body" id="bad-upload" tabindex="-1">
2627
The link we’re trying to access is not loading using a secure connection. We could not verify the Secure Sockets Layer (SSL) certificate.
2728
</p>
@@ -37,7 +38,7 @@
3738
</ul>
3839

3940
<p class="govuk-body">Contact your IT team for support if you need it.</p>
40-
{% elif err.message == "The selected file must be a CSV, GeoJSON, GML or GeoPackage file" %}
41+
{% elif errorMessage == "The selected file must be a CSV, GeoJSON, GML or GeoPackage file" %}
4142
<p class="govuk-body" id="bad-upload" tabindex="-1">The URL returns a HTML webpage. This must be a data file.</p>
4243

4344
<p class="govuk-body">Provide a direct link to the data file in one of the following formats:</p>
@@ -51,15 +52,9 @@
5152
</ul>
5253

5354
<p class="govuk-body">Contact your IT team for support if you need it.</p>
54-
{% elif err.errorDetail is iterable and err.errorDetail is not string %}
55-
{% for detail in err.errorDetail %}
56-
<p class="govuk-body"{% if loop.first %} id="bad-upload" tabindex="-1"{% endif %}>{{ detail }}</p>
57-
{% endfor %}
58-
{% elif err.errorDetail %}
59-
<p class="govuk-body" id="bad-upload" tabindex="-1">{{ err.errorDetail }}</p>
6055
{% else %}
6156
<p class="govuk-body" id="bad-upload" tabindex="-1">
62-
Error: {{ err.message }}
57+
Error: {{ errorMessage }}
6358
</p>
6459
{% endif %}
6560
<p class="govuk-body">Please <a href="/check/upload-method">try again</a> or <a

0 commit comments

Comments
 (0)