mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 18:11:27 -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:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Dialogs"
|
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Dialogs"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Width="480"
|
Width="540"
|
||||||
MinHeight="0"
|
MinHeight="0"
|
||||||
SizeToContent="Height"
|
SizeToContent="Height"
|
||||||
Background="{ui:ThemeResource ApplicationBackgroundBrush}"
|
Background="{ui:ThemeResource ApplicationBackgroundBrush}"
|
||||||
|
@ -22,10 +22,8 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Title = RootTitleBar.Title = $"{App.ProjectName} Exception";
|
Title = RootTitleBar.Title = $"{App.ProjectName} Exception";
|
||||||
ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}";
|
|
||||||
|
|
||||||
if (innerException is not null)
|
AddException(exception);
|
||||||
ErrorRichTextBox.Selection.Text += $"\n\n===== Inner Exception =====\n{innerException.GetType()}: {innerException.Message}";
|
|
||||||
|
|
||||||
if (!App.Logger.Initialized)
|
if (!App.Logger.Initialized)
|
||||||
LocateLogFileButton.Content = "Copy log contents";
|
LocateLogFileButton.Content = "Copy log contents";
|
||||||
@ -66,5 +64,18 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
PInvoke.FlashWindow((HWND)hWnd, true);
|
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