浏览代码

HUE-7398 [dashboard] Do not 500 on Dashboard opening when the first collection is not queryable

Romain Rigaux 8 年之前
父节点
当前提交
05004610a3
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      desktop/libs/dashboard/src/dashboard/models.py

+ 6 - 2
desktop/libs/dashboard/src/dashboard/models.py

@@ -231,8 +231,12 @@ class Collection2(object):
       schema_fields = schema_fields['schema']['fields']
     except Exception, e:
       LOG.warn('/luke call did not succeed: %s' % e)
-      fields = api.schema_fields(name)
-      schema_fields = Collection2._make_luke_from_schema_fields(fields)
+      try:
+        fields = api.schema_fields(name)
+        schema_fields = Collection2._make_luke_from_schema_fields(fields)
+      except Exception, e:
+        LOG.error('Could not access collection: %s' % e)
+        return []
 
     return sorted([self._make_field(field, attributes) for field, attributes in schema_fields.iteritems()])