Przeglądaj źródła

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

Added PopupException
Enrico Berti 11 lat temu
rodzic
commit
61e8d3679d
1 zmienionych plików z 5 dodań i 1 usunięć
  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, {