From 1f0959735f9828a09439f17f1468dcd3dfb914db Mon Sep 17 00:00:00 2001 From: Martin Babinsky Date: Fri, 18 Mar 2016 09:49:41 +0100 Subject: differentiate between limit types when LDAP search exceeds configured limits When LDAP search fails on exceeded limits, we should raise an specific exception for the type of limit raised (size, time, administrative) so that the consumer can distinguish between e.g. searches returning too many entries and those timing out. https://fedorahosted.org/freeipa/ticket/5677 Reviewed-By: Petr Spacek --- ipalib/errors.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'ipalib/errors.py') diff --git a/ipalib/errors.py b/ipalib/errors.py index 52b770027..2507e13dc 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -1612,6 +1612,34 @@ class TaskTimeout(DatabaseError): format = _("%(task)s LDAP task timeout, Task DN: '%(task_dn)s'") +class TimeLimitExceeded(LimitsExceeded): + """ + **4214** Raised when time limit for the operation is exceeded. + """ + + errno = 4214 + format = _('Configured time limit exceeded') + + +class SizeLimitExceeded(LimitsExceeded): + """ + **4215** Raised when size limit for the operation is exceeded. + """ + + errno = 4215 + format = _('Configured size limit exceeded') + + +class AdminLimitExceeded(LimitsExceeded): + """ + **4216** Raised when server limit imposed by administrative authority was + exceeded + """ + + errno = 4216 + format = _('Configured administrative server limit exceeded') + + class CertificateError(ExecutionError): """ **4300** Base class for Certificate execution errors (*4300 - 4399*). -- cgit