From f19705d92da36d77988c7f6ebed6983d3bd0e043 Mon Sep 17 00:00:00 2001 From: Ross Jones Date: Tue, 8 Sep 2015 14:33:42 +0100 Subject: [PATCH] Make sure that SearchIndexErrors *are* raised CKAN relies on the SearchIndexError being raised in the notify() call of IDomainObjectNotification. It still only logs most Exceptions, but explicitly re-raises SearchIndexErrors as they are fatal to CKAN. --- ckan/model/modification.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ckan/model/modification.py b/ckan/model/modification.py index 6a5213170a2..d8bbcaad665 100644 --- a/ckan/model/modification.py +++ b/ckan/model/modification.py @@ -1,5 +1,7 @@ import logging +from ckan.lib.search import SearchIndexError + import ckan.plugins as plugins import domain_object import package as _package @@ -82,6 +84,9 @@ def notify(self, entity, operation): plugins.IDomainObjectModification): try: observer.notify(entity, operation) + except SearchIndexError, search_error: + log.exception(search_error) + raise search_error except Exception, ex: log.exception(ex) @@ -90,5 +95,8 @@ def notify_after_commit(self, entity, operation): plugins.IDomainObjectModification): try: observer.notify_after_commit(entity, operation) + except SearchIndexError, search_error: + log.exception(search_error) + raise search_error except Exception, ex: log.exception(ex)