Improve the Test Connection error message (#1175)

This commit is contained in:
Maxime Beauchemin 2016-09-22 13:09:10 -07:00 committed by Bogdan
parent cbc70d3738
commit 49cefc8b00

View File

@ -1422,9 +1422,10 @@ class Caravel(BaseCaravelView):
engine = create_engine(uri, connect_args=connect_args) engine = create_engine(uri, connect_args=connect_args)
engine.connect() engine.connect()
return json.dumps(engine.table_names(), indent=4) return json.dumps(engine.table_names(), indent=4)
except Exception: except Exception as e:
return Response( return Response((
traceback.format_exc(), "Connection failed!\n\n"
"The error message returned was:\n{}").format(e),
status=500, status=500,
mimetype="application/json") mimetype="application/json")