[ms entity] proper error on external entity fetch error
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 27 Oct 2010 20:29:28 +0200
changeset 6656 bea4ab297e67
parent 6655 75112ff0511d
child 6658 e8ede572b221
[ms entity] proper error on external entity fetch error
entity.py
--- a/entity.py	Wed Oct 27 20:28:57 2010 +0200
+++ b/entity.py	Wed Oct 27 20:29:28 2010 +0200
@@ -633,7 +633,11 @@
             # if some outer join are included to fetch inlined relations
             rql = 'Any %s,%s %s' % (V, ','.join(var for attr, var in selected),
                                     ','.join(rql))
-            rset = self._cw.execute(rql, {'x': self.eid}, build_descr=False)[0]
+            try:
+                rset = self._cw.execute(rql, {'x': self.eid}, build_descr=False)[0]
+            except IndexError:
+                raise Exception('unable to fetch attributes for entity with eid %s'
+                                % self.eid)
             # handle attributes
             for i in xrange(1, lastattr):
                 self.cw_attr_cache[str(selected[i-1][0])] = rset[i]