use of uk.nhs.adaptors.scr.exceptions.BadRequestException in project summary-care-record-api by NHSDigital.
the class AlertService method sendAlert.
public void sendAlert(String body, String nhsdAsid, String nhsdIdentity, String nhsdSessionUrid) {
Response<String> response = spineClient.sendAlert(body, nhsdAsid, nhsdIdentity, nhsdSessionUrid);
HttpStatus status = HttpStatus.resolve(response.getStatusCode());
if (status == null || !status.is2xxSuccessful()) {
OperationOutcome error = fhirParser.parseResource(response.getBody(), OperationOutcome.class);
if (status != null && status.is4xxClientError()) {
LOGGER.error("Spine processing error: {}", status);
throw new BadRequestException(getErrorReason(error));
} else {
LOGGER.error("Spine processing error: {}", getErrorReason(error));
throw new UnexpectedSpineResponseException(getErrorReason(error));
}
}
}
Aggregations