private void getResults(String searchDn, String filter, LdapSearchScope scope,
            final IAsyncResultHandler<List<SearchResultEntry>> result) {
        try {
            SearchScope searchScope = (scope == LdapSearchScope.ONE) ? SearchScope.ONE : SearchScope.SUB;
            List<SearchResultEntry> searchResults = connection.search(searchDn, searchScope, filter).getSearchEntries();
            result.handle(AsyncResultImpl.create(searchResults));
        } catch (LDAPException e) {
            if (ldapErrorHandler == null) {
                LOGGER.error("LDAP Error Handler not set. Error may be swallowed; "
                    + "this is probably not what you intended.", e);
            }
            ldapErrorHandler.handle(DefaultExceptionFactory.create(e));
        } catch (Exception e) {
            result.handle(AsyncResultImpl.<List<SearchResultEntry>>create(e));
        }
    }
@author Marc Savy {@literal <msavy@redhat.com>}
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultLdapSearchImpl.java