Skip to content

Commit

Permalink
Check for connection errors when opening a new connection
Browse files Browse the repository at this point in the history
This fixes a crash when trying to connect using a disabled account
  • Loading branch information
pstranak-sw committed Mar 18, 2018
1 parent af4f26f commit d6982ef
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Src/SwqlStudio/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ private void startTimer_Tick(object sender, EventArgs e)

private void menuFileNew_Click(object sender, EventArgs e)
{
this.connectionsManager.CreateConnection();
try
{
ConnectionInfo.DoWithExceptionTranslation(() => connectionsManager.CreateConnection());
}
catch (Exception ex)
{
log.Error("Failed to connect", ex);
var msg = $"Unable to connect to Information Service.\n{ex.Message}";
MessageBox.Show(msg, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void menuFileOpen_Click(object sender, EventArgs e)
Expand Down

0 comments on commit d6982ef

Please sign in to comment.