[server] Remove pseudo-handling of exceptions in Repository._delete_cascade_multi()
It seems to me that we never want to pass on an exception here be it in "test"
mode or not, so remove the last `except Exception:` clause. For instance, the
actual implementation would pass on an IntegrityError and thus possibly hide
it in a log message.
Concerning the `except Unauthorized:`, as said by the log message this should
not happen because we are within a `security_enabled(write=False)` context. So
remove it as well.
As far as I can tell, this strange handling of exceptions dates from
37668bf302f5 and there is no clear justification to it.
--- a/cubicweb/server/repository.py Thu Feb 09 10:31:15 2017 +0100
+++ b/cubicweb/server/repository.py Mon Feb 20 15:56:07 2017 +0100
@@ -44,7 +44,7 @@
from cubicweb import (CW_MIGRATION_MAP, QueryError,
UnknownEid, AuthenticationError, ExecutionError,
- BadConnectionId, ValidationError, Unauthorized,
+ BadConnectionId,
UniqueTogetherError, onevent, ViolatedConstraint)
from cubicweb import set_log_methods
from cubicweb import cwvreg, schema, server
@@ -823,21 +823,7 @@
rql = 'DELETE X %s Y WHERE X eid IN (%s)' % (rtype, in_eids)
else:
rql = 'DELETE Y %s X WHERE X eid IN (%s)' % (rtype, in_eids)
- try:
- cnx.execute(rql, build_descr=False)
- except ValidationError:
- raise
- except Unauthorized:
- self.exception(
- 'Unauthorized exception while cascading delete for entity %s. '
- 'RQL: %s.\nThis should not happen since security is disabled here.',
- entities, rql)
- raise
- except Exception:
- if self.config.mode == 'test':
- raise
- self.exception('error while cascading delete for entity %s. RQL: %s',
- entities, rql)
+ cnx.execute(rql, build_descr=False)
def init_entity_caches(self, cnx, entity, source):
"""Add entity to connection entities cache and repo's cache."""