class ClientSecurityExceptionMessageResolver {

    public void consumeExceptionMessage(final Throwable exception,
                                        final Consumer<String> messageConsumer) {
        if (shouldDisplayError().test(exception)) {
            final String message = isSecurityManagementException().test(exception) ?
                    getSecurityExceptionMessage().apply((SecurityManagementException) exception) :
                    getExceptionMessage().apply(exception);
            messageConsumer.accept(message);
        }
    }

}