@defra/lis-infra-ui-services 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/package.json +1 -1
- package/src/errors/index.js +1 -4
- package/src/errors/index.test.js +2 -2
package/README.md
CHANGED
|
@@ -177,9 +177,10 @@ The main entry point (`@defra/lis-infra-ui-services`) exports `buildMicrositePat
|
|
|
177
177
|
| ------------- | ---------------------- |
|
|
178
178
|
| 404 | `page-not-found` |
|
|
179
179
|
| 401, 403 | `not-authorised` |
|
|
180
|
-
| 503 | `service-unavailable` |
|
|
181
180
|
| anything else | `problem-with-service` |
|
|
182
181
|
|
|
182
|
+
A 503 from a dependency (a service token that cannot be issued, an open circuit) is a problem with the service, not maintenance. The `service-unavailable` page is only rendered by the maintenance plugin below, which knows when the service is back.
|
|
183
|
+
|
|
183
184
|
5xx responses are logged at `error`, and 4xx responses other than 401, 403 and 404 at `warn`, each with the error object and the ECS fields `http.request.method`, `url.path` and `http.response.status_code`. Boom messages are logged, so application code must not put user-supplied text in them.
|
|
184
185
|
|
|
185
186
|
```js
|
package/package.json
CHANGED
package/src/errors/index.js
CHANGED
|
@@ -5,8 +5,7 @@ import { isAnsweredByMaintenance } from '../maintenance.js'
|
|
|
5
5
|
import {
|
|
6
6
|
notAuthorised,
|
|
7
7
|
pageNotFound,
|
|
8
|
-
problemWithService
|
|
9
|
-
serviceUnavailable
|
|
8
|
+
problemWithService
|
|
10
9
|
} from './error-pages.js'
|
|
11
10
|
import { statusCodes } from '../status-codes.js'
|
|
12
11
|
|
|
@@ -17,8 +16,6 @@ function errorPageFor(statusCode) {
|
|
|
17
16
|
case statusCodes.unauthorized:
|
|
18
17
|
case statusCodes.forbidden:
|
|
19
18
|
return notAuthorised
|
|
20
|
-
case statusCodes.serviceUnavailable:
|
|
21
|
-
return serviceUnavailable
|
|
22
19
|
default:
|
|
23
20
|
return problemWithService
|
|
24
21
|
}
|
package/src/errors/index.test.js
CHANGED
|
@@ -67,8 +67,8 @@ test.each([
|
|
|
67
67
|
],
|
|
68
68
|
[
|
|
69
69
|
statusCodes.serviceUnavailable,
|
|
70
|
-
'error/service
|
|
71
|
-
'Sorry, the service
|
|
70
|
+
'error/problem-with-service',
|
|
71
|
+
'Sorry, there is a problem with the service'
|
|
72
72
|
]
|
|
73
73
|
])(
|
|
74
74
|
'catchAll renders a %i as the %s page titled "%s"',
|