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
1 changed files with 4 additions and 3 deletions

View File

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