From b12f79e79e7d389fcedc2fc7f6e2e0f88941ac8e Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Mon, 29 Aug 2016 21:22:15 -0500 Subject: [PATCH] Included user-friendly message in exception window --- PKHeX/Misc/ErrorWindow.cs | 58 ++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/PKHeX/Misc/ErrorWindow.cs b/PKHeX/Misc/ErrorWindow.cs index 592222b65..565cb1cad 100644 --- a/PKHeX/Misc/ErrorWindow.cs +++ b/PKHeX/Misc/ErrorWindow.cs @@ -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);