Skip to content

Commit

Permalink
Handle exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tnakamot committed Jul 3, 2024
1 parent 0ca1450 commit b42c30d
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions QSBLinearEncoderReader/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,17 @@ private void buttonOpenCSV_Click(object sender, EventArgs e)
return;
}

System.Diagnostics.Process.Start(path);
try
{
System.Diagnostics.Process.Start(path);
}
catch(Exception ex)
{
string msg = "File path: " + path + System.Environment.NewLine + System.Environment.NewLine;
msg += "Error message: " + ex.Message + System.Environment.NewLine + System.Environment.NewLine;
msg += "Stack trace: " + System.Environment.NewLine + ex.StackTrace;
MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void buttonOpenOutputDirectory_Click(object sender, EventArgs e)
Expand All @@ -182,7 +192,17 @@ private void buttonOpenOutputDirectory_Click(object sender, EventArgs e)
return;
}

System.Diagnostics.Process.Start(path);
try
{
System.Diagnostics.Process.Start(path);
}
catch (Exception ex)
{
string msg = "File path: " + path + System.Environment.NewLine + System.Environment.NewLine;
msg += "Error message: " + ex.Message + System.Environment.NewLine + System.Environment.NewLine;
msg += "Stack trace: " + System.Environment.NewLine + ex.StackTrace;
MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

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

0 comments on commit b42c30d

Please sign in to comment.