Skip to content

Commit

Permalink
Improving error details dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Feb 19, 2022
1 parent 86c063f commit 101b33c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 45 deletions.
8 changes: 4 additions & 4 deletions FetchXmlBuilder/FetchXmlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ internal void FetchResults(string fetch = "")
}
if (string.IsNullOrEmpty(fetch))
{
fetch = dockControlBuilder.GetFetchString(false, true);
fetch = dockControlBuilder.GetFetchString(true, true);
}
if (string.IsNullOrEmpty(fetch))
{
Expand Down Expand Up @@ -824,7 +824,7 @@ internal void LoadViews(Action viewsLoaded)
EnableControls(true);
if (completedargs.Error != null)
{
ErrorDetail.ShowDialog(this, completedargs.Error);
ErrorDetail.ShowDialog(this, completedargs.Error, "Loading Views");
}
else
{
Expand Down Expand Up @@ -1081,7 +1081,7 @@ private void ExecuteFetch(string fetch)
working = false;
if (completedargs.Error != null)
{
ErrorDetail.ShowDialog(this, completedargs.Error);
ErrorDetail.ShowDialog(this, completedargs.Error, "Execute Fetch", fetch);
}
else if (completedargs.Result is string)
{
Expand Down Expand Up @@ -1622,7 +1622,7 @@ private void RetrieveMultiple(string fetch)
if (completedargs.Error != null)
{
LogError("RetrieveMultiple error: {0}", completedargs.Error);
ErrorDetail.ShowDialog(this, completedargs.Error);
ErrorDetail.ShowDialog(this, completedargs.Error, "Executing FetchXML", fetch);
}
else if (completedargs.Cancelled)
{
Expand Down
56 changes: 27 additions & 29 deletions FetchXmlBuilder/Forms/ErrorDetail.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 14 additions & 11 deletions FetchXmlBuilder/Forms/ErrorDetail.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Xrm.Sdk;
using Rappen.XTB.Helpers.Extensions;
using Rappen.XTB.Helpers.XTBExtensions;
using System;
using System.ServiceModel;
Expand All @@ -9,30 +10,32 @@ namespace Cinteros.Xrm.FetchXmlBuilder.Forms
{
public partial class ErrorDetail : Form
{
private PluginControlBase owner;
private DateTime timestamp;
private Exception exception;
private PluginControlBase owner;
private string extrainfo;

public static void ShowDialog(PluginControlBase owner, Exception error, string heading = null)
public static void ShowDialog(PluginControlBase owner, Exception exception, string heading = null, string extrainfo = null)
{
if (error == null)
if (exception == null)
{
return;
}
new ErrorDetail(owner, error, heading).ShowDialog(owner);
new ErrorDetail(owner, exception, heading, extrainfo).ShowDialog(owner);
}

private ErrorDetail(PluginControlBase owner, Exception error, string heading)
private ErrorDetail(PluginControlBase owner, Exception exception, string heading, string extrainfo)
{
this.owner = owner;
exception = error;
this.exception = exception;
this.extrainfo = extrainfo;
timestamp = DateTime.Now;
InitializeComponent();
if (!string.IsNullOrEmpty(heading))
{
Text = heading;
}
AddErrorInfo(error);
AddErrorInfo(exception);
Height = 200;
}

Expand Down Expand Up @@ -68,7 +71,7 @@ private void AddErrorInfo(Exception error)
}
msg = msg.Trim();
txtInfo.Text = msg;
txtException.Text = error.GetType().ToString();
txtException.Text = error.ToTypeString();
txtMessage.Text = error.Message;
txtCallStack.Text = error.StackTrace.Trim();
}
Expand All @@ -82,15 +85,15 @@ private void btnDetails_Click(object sender, EventArgs e)
{
if (Height < 300)
{
btnDetails.Text = "Details <<";
btnDetails.Text = "Hide Details";
panDetails.Visible = true;
btnCopy.Visible = true;
btnIssue.Visible = true;
Height = 550;
}
else
{
btnDetails.Text = "Details >>";
btnDetails.Text = "Show Details";
panDetails.Visible = false;
btnCopy.Visible = false;
btnIssue.Visible = false;
Expand All @@ -114,7 +117,7 @@ private void btnCopy_Click(object sender, EventArgs e)

private void btnIssue_Click(object sender, EventArgs e)
{
GitHub.CreateNewIssueFromError(owner, exception);
GitHub.CreateNewIssueFromError(owner, exception, extrainfo);
TopMost = false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/Forms/ErrorDetail.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAK
6wAACusBgosNWgAAAAd0SU1FB9YFFw4AMCHaqGIAAAjRSURBVFhHvVd7cJT1Ff0lIe9sXiASAsaEEEEe
6gAACuoBUMzvvgAAAAd0SU1FB9YFFw4AMCHaqGIAAAjRSURBVFhHvVd7cJT1Ff0lIe9sXiASAsaEEEEe
Ig9teAqCCFQe8miB2ikdrXVkHEFaZaRjO7aO0oAzRQQKhEcQIUghRCBQESxGnoUQIJB3NrvJ7mZ3k91v
d7/NJpucnt+XCAksHf9ovTMnu5lkvnPu/d177u8T90TQj4TugTQRrg4Sm9QnhF0dF6e6x8aqrp/oVOdT
OtUxJkZtHBWjWiVGRqvmEdFqPWEYFqUahkSqeqJycIRaMShCLc2IVG9nRKgl6eHqjbQwtZi49mioWpQS
Expand Down

0 comments on commit 101b33c

Please sign in to comment.