Преглед на файлове

HUE-2141 [search] Fail gracefully when a collection does not exist

Added PopupException
Enrico Berti преди 11 години
родител
ревизия
61e8d3679d
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      apps/search/src/search/views.py

+ 5 - 1
apps/search/src/search/views.py

@@ -55,7 +55,11 @@ def index(request):
     else:
       return no_collections(request)
 
-  collection = Collection.objects.get(id=collection_id) # TODO perms HUE-1987
+  try:
+    collection = Collection.objects.get(id=collection_id) # TODO perms HUE-1987
+  except Exception, e:
+    raise PopupException(e, title=_('Error while accessing the collection'))
+
   query = {'qs': [{'q': ''}], 'fqs': [], 'start': 0}
 
   return render('search.mako', request, {