浏览代码

[search] Log all caught naked "except:" blocks

Erick Tryzelaar 10 年之前
父节点
当前提交
f44970b
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 3 4
      apps/search/src/search/search_controller.py
  2. 1 0
      apps/search/src/search/views.py

+ 3 - 4
apps/search/src/search/search_controller.py

@@ -106,8 +106,7 @@ class SearchController(object):
           doc2.save()
       result['status'] = 0
     except Exception, e:
-      print e
-      LOG.warn('Error copying collection: %s' % e)
+      LOG.exception('Error copying collection')
       result['message'] = unicode(str(e), "utf8")
 
     return result
@@ -128,12 +127,12 @@ class SearchController(object):
     try:
       indexes = self.get_solr_collection().keys()
     except:
-      pass
+      LOG.exception('failed to get indexes')
 
     try:
       indexes += SolrApi(SOLR_URL.get(), self.user).aliases().keys()
     except:
-      pass
+      LOG.exception('failed to get index aliases')
 
     if show_all or not indexes:
       return indexes + SolrApi(SOLR_URL.get(), self.user).cores().keys()

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

@@ -138,6 +138,7 @@ def search(request):
       try:
         response['error'] = json.loads(e.message)['error']['msg']
       except:
+        LOG.exception('failed to parse json response')
         response['error'] = force_unicode(e)
     except Exception, e:
       raise PopupException(e, title=_('Error while accessing Solr'))