Fixed python exception error when user tries to download the CSV and there is a connection issue. Fixes #4858

This commit is contained in:
Murtuza Zabuawala
2020-04-15 16:46:03 +05:30
committed by Akshay Joshi
parent ed0a596286
commit c41da41efe
4 changed files with 49 additions and 24 deletions
+5 -1
View File
@@ -1370,8 +1370,12 @@ def start_query_download_tool(trans_id):
] = "attachment;filename={0}".format(filename)
return r
except (ConnectionLost, SSHTunnelConnectionLost):
raise
except Exception as e:
err_msg = gettext("Error: {0}").format(e.strerror)
current_app.logger.error(e)
err_msg = "Error: {0}".format(
e.strerror if hasattr(e, 'strerror') else str(e))
return internal_server_error(errormsg=err_msg)
else:
return internal_server_error(