class AAIClientResponseExceptionMapper extends ResponseExceptionMapper {

    @Override
    public Optional<String> extractMessage(String entity) {

        String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " ";
        try {
            AAIError error = new ObjectMapper().readValue(entity, AAIError.class);
            AAIErrorFormatter formatter = new AAIErrorFormatter(error);
            return Optional.of(errorString + formatter.getMessage());
        } catch (IOException e) {
            return Optional.of(errorString + entity);
        }
    }

    public  AAIClientResponseExceptionMapper();

}