mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-19 09:01:32 -07:00
Unwrap inner exceptions when showing exception
This commit is contained in:
parent
53ccac4b37
commit
f617700457
@ -6,7 +6,7 @@
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Dialogs"
|
||||
mc:Ignorable="d"
|
||||
Width="480"
|
||||
Width="540"
|
||||
MinHeight="0"
|
||||
SizeToContent="Height"
|
||||
Background="{ui:ThemeResource ApplicationBackgroundBrush}"
|
||||
|
@ -22,10 +22,8 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
||||
InitializeComponent();
|
||||
|
||||
Title = RootTitleBar.Title = $"{App.ProjectName} Exception";
|
||||
ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}";
|
||||
|
||||
if (innerException is not null)
|
||||
ErrorRichTextBox.Selection.Text += $"\n\n===== Inner Exception =====\n{innerException.GetType()}: {innerException.Message}";
|
||||
AddException(exception);
|
||||
|
||||
if (!App.Logger.Initialized)
|
||||
LocateLogFileButton.Content = "Copy log contents";
|
||||
@ -66,5 +64,18 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
||||
PInvoke.FlashWindow((HWND)hWnd, true);
|
||||
};
|
||||
}
|
||||
|
||||
private void AddException(Exception exception, bool inner = false)
|
||||
{
|
||||
if (!inner)
|
||||
ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}";
|
||||
|
||||
if (exception.InnerException is null)
|
||||
return;
|
||||
|
||||
ErrorRichTextBox.Selection.Text += $"\n\n[Inner Exception]\n{exception.InnerException.GetType()}: {exception.InnerException.Message}";
|
||||
|
||||
AddException(exception.InnerException, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user