Description
Feature Request
Description
The "handleError" file contains a sendErrorResponse
method, which takes an HTTP status code and an error message, and constructs and sends an HTTP response.
This is only used in the defence/configure
endpoint in the defence controller, but it'd be nice to use this in other endpoints.
This is a refactor ticket, don't add extra validation, just update existing validation.
New validation is covered in #625 .
Acceptance criteria
Note this might require some use of Postman to manually send API requests to the backend.
GIVEN an API request is missing required query params
WHEN the API request is sent
THEN the API response has status code 400
AND the API response body contains an error message
GIVEN an API request is missing required body params
WHEN the API request is sent
THEN the API response has status code 400
AND the API response body contains an error message
GIVEN a valid API request is received on the backend
WHEN the an error occurs server side
THEN the API response has status code 500
AND the API response body contains an error message