mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-24 10:17:35 -05:00
Included user-friendly message in exception window
This commit is contained in:
@@ -80,35 +80,43 @@ public Exception Error
|
||||
set
|
||||
{
|
||||
_error = value;
|
||||
|
||||
var details = new StringBuilder();
|
||||
details.AppendLine("Exception Details:");
|
||||
details.AppendLine(value.ToString());
|
||||
details.AppendLine();
|
||||
|
||||
details.AppendLine("Loaded Assemblies:");
|
||||
details.AppendLine("--------------------");
|
||||
try
|
||||
{
|
||||
foreach (var item in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
details.AppendLine(item.FullName);
|
||||
details.AppendLine(item.Location);
|
||||
details.AppendLine();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
details.AppendLine("An error occurred while listing the Loaded Assemblies:");
|
||||
details.AppendLine(ex.ToString());
|
||||
}
|
||||
details.AppendLine("--------------------");
|
||||
|
||||
T_ExceptionDetails.Text = details.ToString();
|
||||
UpdateExceptionDetailsMessage();
|
||||
}
|
||||
}
|
||||
private Exception _error;
|
||||
|
||||
private void UpdateExceptionDetailsMessage()
|
||||
{
|
||||
var details = new StringBuilder();
|
||||
details.AppendLine("Exception Details:");
|
||||
details.AppendLine(Error.ToString());
|
||||
details.AppendLine();
|
||||
|
||||
details.AppendLine("Loaded Assemblies:");
|
||||
details.AppendLine("--------------------");
|
||||
try
|
||||
{
|
||||
foreach (var item in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
details.AppendLine(item.FullName);
|
||||
details.AppendLine(item.Location);
|
||||
details.AppendLine();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
details.AppendLine("An error occurred while listing the Loaded Assemblies:");
|
||||
details.AppendLine(ex.ToString());
|
||||
}
|
||||
details.AppendLine("--------------------");
|
||||
|
||||
// Include message in case it contains important information, like a file path.
|
||||
details.AppendLine("User Message:");
|
||||
details.AppendLine(Message);
|
||||
|
||||
T_ExceptionDetails.Text = details.ToString();
|
||||
}
|
||||
|
||||
private void btnCopyToClipboard_Click(object sender, EventArgs e)
|
||||
{
|
||||
Clipboard.SetText(T_ExceptionDetails.Text);
|
||||
|
||||
Reference in New Issue
Block a user