Show inner exception in error dialog

This commit is contained in:
pizzaboxer 2023-07-15 16:20:28 +01:00
parent e3cf2ac3a2
commit e4dc6c0600
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8

View File

@ -18,11 +18,16 @@ namespace Bloxstrap.UI
{ {
public ExceptionDialog(Exception exception) public ExceptionDialog(Exception exception)
{ {
Exception? innerException = exception.InnerException;
InitializeComponent(); InitializeComponent();
Title = RootTitleBar.Title = $"{App.ProjectName} Exception"; Title = RootTitleBar.Title = $"{App.ProjectName} Exception";
ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}"; ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}";
if (innerException is not null)
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";