diff --git a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml index 54d8a51..a2c5418 100644 --- a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml +++ b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml @@ -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}" diff --git a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs index e53485d..7915ae4 100644 --- a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs +++ b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs @@ -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); + } } }