Commit dd4885dd authored by Aurelien Campeas's avatar Aurelien Campeas
Browse files

[entity] rather than crashing with an IndexError on entity creation, raise a meaningful exception

parent 2ddeece84808
......@@ -519,7 +519,11 @@ class Entity(AppObject):
rql = 'INSERT %s X: %s' % (cls.__regid__, rql)
else:
rql = 'INSERT %s X' % (cls.__regid__)
created = execute(rql, qargs).get_entity(0, 0)
try:
created = execute(rql, qargs).get_entity(0, 0)
except IndexError:
raise Exception('could not create a %r with %r (%r)' %
(cls.__regid__, rql, qargs))
created._cw_update_attr_cache(attrcache)
cls._cw_handle_pending_relations(created.eid, pendingrels, execute)
return created
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment