Handle connection errors properly in the query tool. Fixes #3528

This commit is contained in:
Akshay Joshi 2018-08-10 13:51:32 +01:00 committed by Dave Page
parent 2eac2f43ac
commit 7b2c1bb9f8
3 changed files with 7 additions and 2 deletions

View File

@ -16,3 +16,4 @@ Bug fixes
*********
| `Bug #3407 <https://redmine.postgresql.org/issues/3407>`_ - Fix keyboard shortcuts layout in the preferences panel.
| `Bug #3528 <https://redmine.postgresql.org/issues/3528>`_ - Handle connection errors properly in the query tool.

View File

@ -332,8 +332,12 @@ def initialize_query_tool(sgid, sid, did=None):
use_binary_placeholder=True,
array_to_string=True)
if connect:
conn.connect()
status, msg = conn.connect()
if not status:
app.logger.error(msg)
return internal_server_error(errormsg=str(msg))
except (ConnectionLost, SSHTunnelConnectionLost) as e:
app.logger.error(e)
raise
except Exception as e:
app.logger.error(e)

View File

@ -307,7 +307,7 @@ def start_query_tool(trans_id):
connect = 'connect' in request.args and request.args['connect'] == '1'
return StartRunningQuery(blueprint, current_app).execute(
return StartRunningQuery(blueprint, current_app.logger).execute(
sql, trans_id, session, connect
)