# HG changeset patch # User Goffi # Date 1452270464 -3600 # Node ID e73e42b4f6ffe8cb268049fd74908cd8f9fb7581 # Parent 8496af26be450f045e72693c5474ee109a7fce71 pgsql storage: getItemsIndex raise NodeNotFound in this make sense diff -r 8496af26be45 -r e73e42b4f6ff sat_pubsub/pgsql_storage.py --- a/sat_pubsub/pgsql_storage.py Thu Jan 07 16:20:43 2016 +0100 +++ b/sat_pubsub/pgsql_storage.py Fri Jan 08 17:27:44 2016 +0100 @@ -922,10 +922,12 @@ query.append(") as x WHERE item=%s") args.append(item_id) - cursor.execute(' '.join(query), args) # XXX: row_number start at 1, but we want that index start at 0 - return cursor.fetchall()[0][0] - 1 + try: + return cursor.fetchall()[0][0] - 1 + except IndexError: + raise error.NodeNotFound() def getItemsPublishers(self, itemIdentifiers): """Get the publishers for all given identifiers