Browse Source

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

Romain Rigaux 8 years ago
parent
commit
05004610a3
1 changed files with 6 additions and 2 deletions
  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']
       schema_fields = schema_fields['schema']['fields']
     except Exception, e:
     except Exception, e:
       LOG.warn('/luke call did not succeed: %s' % 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()])
     return sorted([self._make_field(field, attributes) for field, attributes in schema_fields.iteritems()])