Search in sources :

Example 1 with ScrBaseException

use of uk.nhs.adaptors.scr.exceptions.ScrBaseException in project summary-care-record-api by NHSDigital.

the class SpineHttpClient method sendRequest.

@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE", justification = "SpotBugs issue with fix not yet released https://github.com/spotbugs/spotbugs/pull/1248")
@LogExecutionTime
public <T> Response<T> sendRequest(HttpRequestBase request, ResponseHandler<? extends Response<T>> responseHandler) {
    LOGGER.debug("Attempting to send SPINE request: {}", request.getRequestLine().toString());
    try {
        LOGGER.info("Leased connections: " + clientConnectionManager.getTotalStats().getLeased());
        LOGGER.info("Available connections: " + clientConnectionManager.getTotalStats().getAvailable());
        return client.execute(request, responseHandler, HttpClientContext.create());
    } catch (IOException e) {
        LOGGER.error("Error while sending SPINE request", e);
        throw new ScrBaseException("Unexpected exception while sending Spine request", e);
    }
}
Also used : ScrBaseException(uk.nhs.adaptors.scr.exceptions.ScrBaseException) IOException(java.io.IOException) LogExecutionTime(uk.nhs.adaptors.scr.logging.LogExecutionTime) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 IOException (java.io.IOException)1 ScrBaseException (uk.nhs.adaptors.scr.exceptions.ScrBaseException)1 LogExecutionTime (uk.nhs.adaptors.scr.logging.LogExecutionTime)1