浏览代码

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

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

+ 2 - 1
apps/hbase/src/hbase/api.py

@@ -63,6 +63,7 @@ class HbaseApi(object):
     try:
       full_config = json.loads(conf.HBASE_CLUSTERS.get().replace("'", "\""))
     except:
+      LOG.exception('failed to load the HBase clusters')
       full_config = [conf.HBASE_CLUSTERS.get()] #hack cause get() is weird
 
     for config in full_config:
@@ -84,7 +85,7 @@ class HbaseApi(object):
         if cluster["name"] == name:
           return cluster
     except:
-      pass
+      LOG.exception('failed to get the cluster %s' % name)
     raise PopupException(_("Cluster by the name of %s does not exist in configuration.") % name)
 
   def connectCluster(self, name):

+ 2 - 0
apps/hbase/src/hbase/views.py

@@ -53,6 +53,7 @@ def api_router(request, url): # On split, deserialize anything
     try:
       return json.loads(re.sub(r'(?:\")([0-9]+)(?:\")', r'\1', str(raw)))
     except:
+      LOG.exception('failed to parse input as json')
       return raw
 
   def deserialize(data):
@@ -84,6 +85,7 @@ def api_dump(response):
       json.dumps(data)
       return data
     except:
+      LOG.exception('Failed to dump data as JSON')
       cleaned = {}
       lim = [0]
       if isinstance(data, str): # Not JSON dumpable, meaning some sort of bytestring or byte data