Size Limit Exceptions #769
-
|
Howdy, is there anyway to know that a query results in a SizeLimit Exception? I see in the code you are trapping when that occurs, but no way to expose that it has occurred. In my case, I might be doing a query for an attribute (eg: uidnumber, mail), and if I only get "x" results - I want to know that "x" is the total entries (that have that attribute), and not as a result of the server's sizelimit restriction. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
|
Hi @leenooks, I believe you can retrieve the error code from the connection to determine the result of the last search and if a size limit error occurred. To do this, you can call Line 99 in 0dc536c |
Beta Was this translation helpful? Give feedback.
-
|
@stevebauman Indeed, I think this will work - having just tested it, I do see the error message there. Thanks. Any chance you might change this logic to throw an Exception (eg: If you wanted to suppress the error (as you are currently doing), then catch could just do nothing (or log it) and return the result, but for those who wanted to wrap other logic around the failure, it might make it a bit easier to understand what is going on). Just an idea though, only because I prefer to not have code "looking" for errors per-se, I like the exceptions to catch them when they do infact occur. |
Beta Was this translation helpful? Give feedback.
-
|
@stevebauman I agree on point 2 - it should be still ideal to get the partial results, so you can decide to add to it with another query, or continue with the result, with an advice to the user that it is a limited subset. As an alternative, it might be nicer to have a $hasMore (bool) on the Entry (or even better Anyway, I've worked around it. 👍 |
Beta Was this translation helpful? Give feedback.
Hi @leenooks,
I believe you can retrieve the error code from the connection to determine the result of the last search and if a size limit error occurred. To do this, you can call
getDetailedError()on the LDAP connection:LdapRecord/src/Ldap.php
Line 99 in 0dc536c