소스 검색

HUE-8737 [py3] Properly handle TypeError which does not contain message

Romain 6 년 전
부모
커밋
6aad52a7dd
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 0
      apps/beeswax/src/beeswax/api.py
  2. 1 1
      desktop/core/src/desktop/templates/global_js_constants.mako

+ 3 - 0
apps/beeswax/src/beeswax/api.py

@@ -157,6 +157,9 @@ def _autocomplete(db, database=None, table=None, column=None, nested=None, query
   except (QueryServerTimeoutException, TTransportException) as e:
     response['code'] = 503
     response['error'] = e.message
+  except TypeError as e:
+    response['code'] = 500
+    response['error'] = str(e)
   except Exception as e:
     LOG.warn('Autocomplete data fetching error: %s' % e)
     response['code'] = 500

+ 1 - 1
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -44,7 +44,7 @@
 
   window.CACHEABLE_TTL = {
     default: ${ conf.CUSTOM.CACHEABLE_TTL.get() },
-    optimizer: ${ hasattr(OPTIMIZER, 'ConfigSection') and OPTIMIZER.CACHEABLE_TTL.get() or 0 }
+    optimizer: ${ OPTIMIZER.CACHEABLE_TTL.get() or 0 }
   };
 
   window.DEV = '${ conf.DEV.get() }' === 'True';